/** * Get ensured shapes that wind up being scalar end up with the write shape * @param rows * @param columns * @return */ private static int[] getEnsuredShape(int rows, int columns) { return getEnsuredShape(new int[] {rows, columns}); }
/** * Create a complex ndarray from the passed in indarray * * @param arrs the arr to wrap * @return the complex ndarray with the specified ndarray as the * real components */ public static IComplexNDArray createComplex(List<IComplexNDArray> arrs, int[] shape) { shape = getEnsuredShape(shape); IComplexNDArray ret = INSTANCE.createComplex(arrs, shape); logCreationIfNecessary(ret); return ret; }
/** * Create a complex ndarray from the passed in indarray * * @param data the data to wrap * @return the complex ndarray with the specified ndarray as the * real components */ public static IComplexNDArray createComplex(IComplexNumber[] data, int[] shape) { shape = getEnsuredShape(shape); IComplexNDArray ret = INSTANCE.createComplex(data, shape); logCreationIfNecessary(ret); return ret; }
public static INDArray create(List<INDArray> list, long[] shape) { shape = getEnsuredShape(shape); checkShapeValues(shape); INDArray ret = INSTANCE.create(list, shape); logCreationIfNecessary(ret); return ret; }
public static INDArray create(long[] shape, long[] stride, char ordering) { shape = getEnsuredShape(shape); checkShapeValues(shape); INDArray ret = INSTANCE.create(shape, stride, 0, ordering); logCreationIfNecessary(ret); return ret; }
public static INDArray create(DataBuffer data, long[] shape, long[] strides, long offset) { shape = getEnsuredShape(shape); checkShapeValues(shape); INDArray ret = INSTANCE.create(data, shape, strides, offset); logCreationIfNecessary(ret); return ret; }
public static INDArray create(float[] data, long[] shape, char ordering) { shape = getEnsuredShape(shape); checkShapeValues(data.length, shape); INDArray ret = INSTANCE.create(data, shape, 0, ordering); logCreationIfNecessary(ret); return ret; }
/** * Creates an ndarray with the specified shape * * @param shape the shape of the ndarray * @return the instance */ public static INDArray create(List<INDArray> list, int[] shape, char ordering) { shape = getEnsuredShape(shape); checkShapeValues(shape); INDArray ret = INSTANCE.create(list, shape, ordering); logCreationIfNecessary(ret); return ret; }
public static INDArray create(double[] data, long[] shape, char ordering) { shape = getEnsuredShape(shape); checkShapeValues(data.length, shape); INDArray ret = INSTANCE.create(data, shape, 0, ordering); logCreationIfNecessary(ret); return ret; }
/** * Creates an ndarray with the specified shape * * @param shape the shape of the ndarray * @return the instance */ public static INDArray create(List<INDArray> list, int[] shape) { shape = getEnsuredShape(shape); checkShapeValues(shape); INDArray ret = INSTANCE.create(list, shape); logCreationIfNecessary(ret); return ret; }
/** * Create an ndrray with the specified shape * * @param data the data to use with tne ndarray * @param shape the shape of the ndarray * @return the created ndarray */ public static IComplexNDArray createComplex(float[] data, int[] shape, char ordering) { shape = getEnsuredShape(shape); checkShapeValues(shape); IComplexNDArray ret = INSTANCE.createComplex(data, shape, ordering); logCreationIfNecessary(ret); return ret; }
/** * * @param data * @param shape * @param offset * @return */ public static IComplexNDArray createComplex(DataBuffer data, int[] shape, long offset) { shape = getEnsuredShape(shape); checkShapeValues(shape); IComplexNDArray ret = INSTANCE.createComplex(data, shape, offset); logCreationIfNecessary(ret); return ret; }
/** * * @param shape * @param dataType * @return */ public static INDArray create(int[] shape, DataBuffer.Type dataType) { shape = getEnsuredShape(shape); checkShapeValues(shape); INDArray ret = INSTANCE.create(shape, dataType); logCreationIfNecessary(ret); return ret; }
public static INDArray create(double[] 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; }
public static INDArray create(float[] data, long[] shape, long offset) { shape = getEnsuredShape(shape); if (shape.length == 1) { if (shape[0] == data.length) { shape = new long[] {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, Nd4j.order()); logCreationIfNecessary(ret); return ret; }
public static INDArray create(double[] data, long[] shape, long offset, char ordering) { shape = getEnsuredShape(shape); if (shape.length == 1) { if (shape[0] == data.length) { shape = new long[] {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, Nd4j.getStrides(shape, ordering), offset, ordering); logCreationIfNecessary(ret); return ret; }
/** * Creates a complex ndarray with the specified shape * * @param rows the rows of the ndarray * @param columns the columns of the ndarray * @return the instance */ public static IComplexNDArray createComplex(int rows, int columns, char ordering) { int[] shape = getEnsuredShape(rows, columns); checkShapeValues(shape); IComplexNDArray ret = INSTANCE.createComplex(shape, Nd4j.getComplexStrides(shape, ordering), 0, ordering); logCreationIfNecessary(ret); return ret; }
public static INDArray create(float[] data, long[] shape) { if (shape.length == 0 && data.length == 1) { return trueScalar(data[0]); } shape = getEnsuredShape(shape); if (shape.length == 1) { if (shape[0] != data.length) throw new ND4JIllegalStateException("Shape of the new array doesn't match data length"); } checkShapeValues(data.length, shape); INDArray ret = INSTANCE.create(data, shape); logCreationIfNecessary(ret); return ret; }
public static INDArray create(double[] data, long[] shape) { if (shape.length == 0 && data.length == 1) { return trueScalar(data[0]); } shape = getEnsuredShape(shape); if (shape.length == 1) { if (shape[0] != data.length) throw new ND4JIllegalStateException("Shape of the new array doesn't match data length"); } checkShapeValues(data.length, shape); INDArray ret = INSTANCE.create(data, shape); logCreationIfNecessary(ret); return ret; }
/** * Creates a complex ndarray with the specified shape * * @param shape the shape of the ndarray * @return the instance */ public static IComplexNDArray createComplex(int[] shape, char ordering) { shape = getEnsuredShape(shape); checkShapeValues(shape); IComplexNDArray ret = INSTANCE.createComplex(createBuffer(ArrayUtil.prodLong(shape) * 2), shape, 0, ordering); logCreationIfNecessary(ret); return ret; }