Java Code Examples for org.nd4j.linalg.util.ArrayUtil#toLongArray()
The following examples show how to use
org.nd4j.linalg.util.ArrayUtil#toLongArray() .
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: Shape.java From nd4j with Apache License 2.0 | 6 votes |
/** * Get the shape of the reduced array * @param wholeShape the shape of the array * with the reduce op being performed * @param dimensions the dimensions the reduce op is being performed on * @return the shape of the result array as the result of the reduce */ public static long[] getReducedShape(int[] wholeShape, int[] dimensions) { if (isWholeArray(wholeShape, dimensions)) return new long[] {}; else if (dimensions.length == 1 && wholeShape.length == 2) { val ret = new long[2]; if (dimensions[0] == 1) { ret[0] = wholeShape[0]; ret[1] = 1; } else if (dimensions[0] == 0) { ret[0] = 1; ret[1] = wholeShape[1]; } return ret; } return ArrayUtil.toLongArray(ArrayUtil.removeIndex(wholeShape, dimensions)); }
Example 2
Source File: BaseBroadcastOp.java From nd4j with Apache License 2.0 | 5 votes |
public BaseBroadcastOp(SameDiff sameDiff, SDVariable i_v, int[] shape, boolean inPlace, int[] dimension, Object[] extraArgs) { // FIXME: int cast this(sameDiff, i_v, ArrayUtil.toLongArray(shape), inPlace, dimension, extraArgs); }
Example 3
Source File: BaseTransformOp.java From nd4j with Apache License 2.0 | 5 votes |
public BaseTransformOp(SameDiff sameDiff, SDVariable i_v, int[] shape, boolean inPlace, Object[] extraArgs) { // FIXME: int cast ! this(sameDiff, i_v, ArrayUtil.toLongArray(shape), inPlace, extraArgs); }
Example 4
Source File: ShapeOp.java From nd4j with Apache License 2.0 | 5 votes |
public ShapeOp(SameDiff sameDiff, SDVariable i_v, int[] shape, boolean inPlace, Object[] extraArgs) { // FIXME: int cast this(sameDiff, i_v, ArrayUtil.toLongArray(shape), inPlace, extraArgs); }
Example 5
Source File: JCublasNDArrayFactory.java From nd4j with Apache License 2.0 | 4 votes |
@Override public INDArray create(DataBuffer data, long rows, long columns, int[] stride, long offset) { // FIXME: int cast return new JCublasNDArray(data, new long[] {rows, columns}, ArrayUtil.toLongArray(stride), offset, Nd4j.order()); }
Example 6
Source File: JCublasNDArrayFactory.java From nd4j with Apache License 2.0 | 4 votes |
@Override public INDArray create(float[] data, long rows, long columns, int[] stride, long offset, char ordering) { return new JCublasNDArray(data, new long[] {rows, columns}, ArrayUtil.toLongArray(stride), offset, ordering); }
Example 7
Source File: LongShapeDescriptor.java From nd4j with Apache License 2.0 | 4 votes |
public static LongShapeDescriptor fromShapeDescriptor(@NonNull ShapeDescriptor descriptor) { return new LongShapeDescriptor(ArrayUtil.toLongArray(descriptor.getShape()), ArrayUtil.toLongArray(descriptor.getStride()), descriptor.getOffset(), descriptor.getEws(), descriptor.getOrder()); }
Example 8
Source File: LinearIndexLookup.java From nd4j with Apache License 2.0 | 2 votes |
/** * * @param shape the shape of the linear index * @param ordering the ordering of the linear index */ public LinearIndexLookup(int[] shape, char ordering) { this(ArrayUtil.toLongArray(shape), ordering); }
Example 9
Source File: NdIndexIterator.java From nd4j with Apache License 2.0 | 2 votes |
/** * Pass in the shape to iterate over * @param shape the shape to iterate over */ public NdIndexIterator(char order, int... shape) { this(order, false, ArrayUtil.toLongArray(shape)); }
Example 10
Source File: BaseComplexNDArray.java From nd4j with Apache License 2.0 | 2 votes |
/** * Initialize the given ndarray as the real component * * @param m the real component * @param stride the stride of the ndarray * @param ordering the ordering for the ndarray */ public BaseComplexNDArray(INDArray m, int[] stride, char ordering) { this(m.shape(), ArrayUtil.toLongArray(stride), ordering); copyFromReal(m); }