Java Code Examples for org.nd4j.linalg.api.shape.Shape#shapeToStringShort()
The following examples show how to use
org.nd4j.linalg.api.shape.Shape#shapeToStringShort() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BaseNDArray.java From deeplearning4j with Apache License 2.0 | 6 votes |
@Override public double[][] toDoubleMatrix() { if(!isMatrix()) { throw new ND4JIllegalStateException("Unable to create a 2d array from a non matrix! Shape: " + Shape.shapeToStringShort(this)); } if (this.size(0) > Integer.MAX_VALUE || this.size(1) > Integer.MAX_VALUE) throw new ND4JArraySizeException(); double[][] ret = new double[rows()][columns()]; for(int i = 0; i < ret.length; i++) { ret[i] = getRow(i).dup().data().asDouble(); } return ret; }
Example 2
Source File: BaseNDArray.java From deeplearning4j with Apache License 2.0 | 6 votes |
@Override public float[][] toFloatMatrix() { if(!isMatrix()) { throw new ND4JIllegalStateException("Unable to create a 2d array from a non matrix! Shape: " + Shape.shapeToStringShort(this)); } if (this.rows() > Integer.MAX_VALUE || this.columns() > Integer.MAX_VALUE) throw new ND4JArraySizeException(); float[][] ret = new float[(int) rows()][ (int) columns()]; for(int i = 0; i < ret.length; i++) { ret[i] = getRow(i).dup().data().asFloat(); } return ret; }
Example 3
Source File: BaseNDArray.java From deeplearning4j with Apache License 2.0 | 6 votes |
@Override public long[][] toLongMatrix() { if(!isMatrix()) { throw new ND4JIllegalStateException("Unable to create a 2d array from a non matrix! Shape: " + Shape.shapeToStringShort(this)); } if (this.rows() > Integer.MAX_VALUE || this.columns() > Integer.MAX_VALUE) throw new ND4JArraySizeException(); long[][] ret = new long[(int) rows()][(int) columns()]; for(int i = 0; i < ret.length; i++) { ret[i] = getRow(i).dup().data().asLong(); } return ret; }
Example 4
Source File: BaseNDArray.java From deeplearning4j with Apache License 2.0 | 6 votes |
@Override public int[][] toIntMatrix() { if(!isMatrix()) { throw new ND4JIllegalStateException("Unable to create a 2d array from a non matrix! Shape: " + Shape.shapeToStringShort(this)); } if (this.rows() > Integer.MAX_VALUE || this.columns() > Integer.MAX_VALUE) throw new ND4JArraySizeException(); int[][] ret = new int[(int) rows()][(int) columns()]; for(int i = 0; i < ret.length; i++) { ret[i] = getRow(i).dup().data().asInt(); } return ret; }
Example 5
Source File: BaseNDArray.java From deeplearning4j with Apache License 2.0 | 5 votes |
@Override public double[] toDoubleVector() { if(!isVectorOrScalar()) { throw new ND4JIllegalStateException("Unable to create a 1d array from a non vector! Shape: " + Shape.shapeToStringShort(this)); } return dup().data().asDouble(); }
Example 6
Source File: BaseNDArray.java From deeplearning4j with Apache License 2.0 | 5 votes |
@Override public float[] toFloatVector() { if(!isVectorOrScalar()) { throw new ND4JIllegalStateException("Unable to create a 1d array from a non vector! Shape: " + Shape.shapeToStringShort(this)); } return dup().data().asFloat(); }
Example 7
Source File: BaseNDArray.java From deeplearning4j with Apache License 2.0 | 5 votes |
@Override public int[] toIntVector() { if (isEmpty()) return new int[0]; if(!isVectorOrScalar()) { throw new ND4JIllegalStateException("Unable to create a 1d array from a non vector! Shape: " + Shape.shapeToStringShort(this)); } if(isView() || elementWiseStride() != 1){ return dup().data().asInt(); } return data().asInt(); }
Example 8
Source File: BaseNDArray.java From deeplearning4j with Apache License 2.0 | 5 votes |
@Override public long[] toLongVector() { if(!isVectorOrScalar()) { throw new ND4JIllegalStateException("Unable to create a 1d array from a non vector! Shape: " + Shape.shapeToStringShort(this)); } if(isView() || elementWiseStride() != 1){ return dup().data().asLong(); } return data().asLong(); }