nd4j-serde/nd4j-kryo/src/main/java/org/nd4j/Nd4jSerializer.java
@Override
    public void write(Kryo kryo, Output output, INDArray object) {
        DataOutputStream dos = new DataOutputStream(output);
        try {
            Nd4j.write(object, dos);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        //Note: output should NOT be closed manually here - may be needed elsewhere (and closing here will cause serialization to fail)
    }
@Override
    public void write(Kryo kryo, Output output, INDArray object) {
        DataOutputStream dos = new DataOutputStream(output);
        try {
            Nd4j.write(object, dos);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        //Note: output should NOT be closed manually here - may be needed elsewhere (and closing here will cause serialization to fail)
    }
Writes the bytes for the object to the output.
<p>
This method should not be called directly, instead this serializer can be passed to {@link Kryo} write methods that accept a
serialier.

@param kryo
@param output
@param object May be null if {@link #getAcceptsNull()} is true.