use of org.nd4j.linalg.exception.ND4JIllegalStateException in project nd4j by deeplearning4j.
the class Nd4j method createComplex.
/**
* Creates a complex ndarray with the specified shape
*
* @param rows the rows of the ndarray
* @param columns the columns of the ndarray
* @param stride the stride for the ndarray
* @param offset the offset of the ndarray
* @return the instance
*/
public static IComplexNDArray createComplex(double[] data, int rows, int columns, int[] stride, long offset) {
if (rows < 1 || columns < 1)
throw new ND4JIllegalStateException("Number of rows and columns should be positive for new INDArray");
IComplexNDArray ret = INSTANCE.createComplex(data, rows, columns, stride, offset);
logCreationIfNecessary(ret);
return ret;
}
use of org.nd4j.linalg.exception.ND4JIllegalStateException in project nd4j by deeplearning4j.
the class Nd4j method create.
/**
* Creates an ndarray with the specified shape
*
* @param data the data to use with the ndarray
* @param rows the rows of the ndarray
* @param columns the columns of the ndarray
* @param stride the stride for the ndarray
* @param offset the offset of the ndarray
* @return the instance
*/
public static INDArray create(float[] data, int rows, int columns, int[] stride, long offset) {
if (rows < 1 || columns < 1)
throw new ND4JIllegalStateException("Number of rows and columns should be positive for new INDArray");
INDArray ret = INSTANCE.create(data, rows, columns, stride, offset);
logCreationIfNecessary(ret);
return ret;
}
use of org.nd4j.linalg.exception.ND4JIllegalStateException in project nd4j by deeplearning4j.
the class Nd4j method valueArrayOf.
/**
* Creates a row vector with the specified number of columns
*
* Some people may know this as np.full
*
* @param rows the number of rows in the matrix
* @param columns the columns of the ndarray
* @param value the value to assign
* @return the created ndarray
*/
public static INDArray valueArrayOf(int rows, int columns, double value) {
if (rows < 1 || columns < 1)
throw new ND4JIllegalStateException("Number of rows and columns should be positive for new INDArray");
INDArray ret = INSTANCE.valueArrayOf(rows, columns, value);
logCreationIfNecessary(ret);
return ret;
}
use of org.nd4j.linalg.exception.ND4JIllegalStateException in project nd4j by deeplearning4j.
the class Nd4j method create.
/**
* @param data
* @param shape
* @param offset
* @return
*/
public static INDArray create(double[] data, int[] shape, long offset) {
shape = getEnsuredShape(shape);
if (shape.length == 1) {
if (shape[0] == data.length) {
shape = new int[] { 1, data.length };
} else
throw new ND4JIllegalStateException("Shape of the new array " + Arrays.toString(shape) + " doesn't match data length: " + data.length);
}
checkShapeValues(data.length, shape);
INDArray ret = INSTANCE.create(data, shape, offset);
logCreationIfNecessary(ret);
return ret;
}
use of org.nd4j.linalg.exception.ND4JIllegalStateException in project nd4j by deeplearning4j.
the class Nd4j method create.
/**
* @param data
* @param shape
* @param ordering
* @param offset
* @return
*/
public static INDArray create(float[] data, int[] shape, char ordering, long offset) {
shape = getEnsuredShape(shape);
if (shape.length == 1) {
if (shape[0] != data.length)
throw new ND4JIllegalStateException("Shape of the new array " + Arrays.toString(shape) + " doesn't match data length: " + data.length);
}
checkShapeValues(data.length, shape);
INDArray ret = INSTANCE.create(data, shape, getStrides(shape, ordering), offset, ordering);
logCreationIfNecessary(ret);
return ret;
}
Aggregations