@ Override public INDArray compress ( float [ ] data , int [ ] shape , char order ) { FloatPointer pointer = new FloatPointer ( data ) ; DataBuffer shapeInfo = Nd4j . getShapeInfoProvider ( ) . createShapeInformation ( ArrayUtil . toLongArray ( shape ) , order , DataType . FLOAT ) . getFirst ( ) ; DataBuffer buffer = compressPointer ( DataTypeEx . FLOAT , pointer , data . length , 4 ) ; return Nd4j . createArrayFromShapeBuffer ( buffer , shapeInfo ) ; }
This method creates compressed INDArray from Java float array skipping usual INDArray instantiation routines