public BaseSparseNDArrayCOO(DataBuffer values, DataBuffer indices, DataBuffer sparseInformation, int[] shape) { this.values = Nd4j.createBuffer(values, 0, values.length()); this.indices = indices; setShapeInformation(Nd4j.getShapeInfoProvider().createShapeInformation(shape)); init(shape); this.sparseInformation = sparseInformation; this.length = countNNZ(); }
public BaseSparseNDArrayCOO(DataBuffer values, DataBuffer indices, int[] shape) { checkArgument(values.length() * shape.length == indices.length()); this.values = Nd4j.createBuffer(values, 0, values.length()); this.indices = indices; setShapeInformation(Nd4j.getShapeInfoProvider().createShapeInformation(shape)); init(shape); this.length = values.length(); int[] flags = new int[rank()]; long[] sparseOffsets = new long[rank()]; int[] hiddenDimension = new int[] {-1}; this.sparseInformation = Nd4j.getSparseInfoProvider().createSparseInformation(flags, sparseOffsets, hiddenDimension, rank()); }
public BaseSparseNDArrayCOO(float[] values, int[][] indices, int[] shape) { checkArgument(values.length == indices.length); checkArgument(values.length == 0 || indices[0].length == shape.length); this.values = Nd4j.createBuffer(values); this.indices = Nd4j.createBuffer(ArrayUtil.flatten(indices)); setShapeInformation(Nd4j.getShapeInfoProvider().createShapeInformation(shape)); init(shape); this.length = values.length; int[] flags = new int[rank()]; long[] sparseOffsets = new long[rank()]; int[] hiddenDimension = new int[] {-1}; this.sparseInformation = Nd4j.getSparseInfoProvider().createSparseInformation(flags, sparseOffsets, hiddenDimension, rank()); }
init(shape); int[] flags = new int[rank()]; long[] sparseOffsets = new long[rank()];