public static void doByteBufferPutUnCompressed(INDArray arr, ByteBuffer allocated, boolean rewind) {
        // ensure we send data to host memory
        Nd4j.getExecutioner().commit();
        Nd4j.getAffinityManager().ensureLocation(arr, AffinityManager.Location.HOST);

        ByteBuffer buffer = arr.data().pointer().asByteBuffer().order(ByteOrder.nativeOrder());
        ByteBuffer shapeBuffer = arr.shapeInfoDataBuffer().pointer().asByteBuffer().order(ByteOrder.nativeOrder());
        //2 four byte ints at the beginning
        allocated.putInt(arr.rank());
        //put data opType next so its self describing
        allocated.putInt(arr.data().dataType().ordinal());
        allocated.put(shapeBuffer);
        allocated.put(buffer);
        if (rewind)
            allocated.rewind();
    }
public static void doByteBufferPutUnCompressed ( INDArray arr , ByteBuffer allocated , boolean rewind ) { Nd4j . getExecutioner ( ) . commit ( ) ; Nd4j . getAffinityManager ( ) . ensureLocation ( arr , AffinityManager . Location . HOST ) ; ByteBuffer buffer = arr . data ( ) . pointer ( ) . asByteBuffer ( ) . order ( ByteOrder . nativeOrder ( ) ) ; ByteBuffer shapeBuffer = arr . shapeInfoDataBuffer ( ) . pointer ( ) . asByteBuffer ( ) . order ( ByteOrder . nativeOrder ( ) ) ; allocated . putInt ( arr . rank ( ) ) ; allocated . putInt ( arr . data ( ) . dataType ( ) . ordinal ( ) ) ; allocated . put ( shapeBuffer ) ; allocated . put ( buffer ) ; if ( rewind ) allocated . rewind ( ) ; }
Setup the given byte buffer
for serialization (note that this is for uncompressed INDArrays)
4 bytes int for rank
4 bytes for data opType
shape buffer
data buffer

@param arr the array to setup
@param allocated the byte buffer to setup
@param rewind whether to rewind the byte buffer or nt