/** * Read in an ndarray from a data input stream * * @param dis the data input stream to read from * @return the ndarray * @throws IOException */ public static INDArray read(DataInputStream dis) throws IOException { DataBuffer shapeInformation = Nd4j.createBufferDetached(new long[1], DataBuffer.Type.LONG); shapeInformation.read(dis); int length = Shape.length(shapeInformation); DataBuffer data = CompressedDataBuffer.readUnknown(dis, length); return createArrayFromShapeBuffer(data, shapeInformation); }
/** * Read in an ndarray from a data input stream * * @param dis the data input stream to read from * @return the ndarray * @throws IOException */ public static INDArray read(DataInputStream dis) throws IOException { DataBuffer shapeInformation = Nd4j.createBufferDetached(new int[1], DataBuffer.Type.INT); shapeInformation.read(dis); int length = Shape.length(shapeInformation); DataBuffer data = CompressedDataBuffer.readUnknown(dis, length); return createArrayFromShapeBuffer(data, shapeInformation); }