Search in sources :

Example 1 with NDArrayDeSerializer

use of org.nd4j.shade.serde.jackson.ndarray.NDArrayDeSerializer in project deeplearning4j by deeplearning4j.

the class ObjectMapperProvider method module.

public static SimpleModule module() {
    SimpleModule module = new SimpleModule("nd4j");
    module.addDeserializer(INDArray.class, new NDArrayDeSerializer());
    module.addSerializer(INDArray.class, new NDArraySerializer());
    return module;
}
Also used : NDArrayDeSerializer(org.nd4j.shade.serde.jackson.ndarray.NDArrayDeSerializer) NDArraySerializer(org.nd4j.shade.serde.jackson.ndarray.NDArraySerializer) SimpleModule(com.fasterxml.jackson.databind.module.SimpleModule)

Example 2 with NDArrayDeSerializer

use of org.nd4j.shade.serde.jackson.ndarray.NDArrayDeSerializer in project deeplearning4j by deeplearning4j.

the class TestSerialization method getMapper.

public ObjectMapper getMapper() {
    ObjectMapper mapper = new ObjectMapper();
    SimpleModule nd4j = new SimpleModule("nd4j");
    nd4j.addDeserializer(INDArray.class, new NDArrayDeSerializer());
    nd4j.addSerializer(INDArray.class, new NDArraySerializer());
    mapper.registerModule(nd4j);
    return mapper;
}
Also used : NDArrayDeSerializer(org.nd4j.shade.serde.jackson.ndarray.NDArrayDeSerializer) NDArraySerializer(org.nd4j.shade.serde.jackson.ndarray.NDArraySerializer) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) SimpleModule(com.fasterxml.jackson.databind.module.SimpleModule)

Aggregations

SimpleModule (com.fasterxml.jackson.databind.module.SimpleModule)2 NDArrayDeSerializer (org.nd4j.shade.serde.jackson.ndarray.NDArrayDeSerializer)2 NDArraySerializer (org.nd4j.shade.serde.jackson.ndarray.NDArraySerializer)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1