diff --git a/cavis-dnn/cavis-dnn-nn/src/main/java/org/deeplearning4j/nn/conf/NeuralNetConfiguration.java b/cavis-dnn/cavis-dnn-nn/src/main/java/org/deeplearning4j/nn/conf/NeuralNetConfiguration.java index e6042e3d6..c9a767342 100644 --- a/cavis-dnn/cavis-dnn-nn/src/main/java/org/deeplearning4j/nn/conf/NeuralNetConfiguration.java +++ b/cavis-dnn/cavis-dnn-nn/src/main/java/org/deeplearning4j/nn/conf/NeuralNetConfiguration.java @@ -22,6 +22,7 @@ package org.deeplearning4j.nn.conf; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.exc.InvalidTypeIdException; @@ -164,8 +165,13 @@ public class NeuralNetConfiguration extends NeuralNetBaseBuilderConfiguration { * @return {@link NeuralNetConfiguration} */ public static NeuralNetConfiguration fromJson(String json) { - NeuralNetConfiguration conf; ObjectMapper mapper = NeuralNetConfiguration.mapper(); + try { + return mapper.readValue(json, NeuralNetConfiguration.class); + } catch (JsonProcessingException e) { + throw new RuntimeException(e); + } +/* try { conf = mapper.readValue(json, NeuralNetConfiguration.class); } catch (InvalidTypeIdException e) { @@ -334,6 +340,8 @@ public class NeuralNetConfiguration extends NeuralNetBaseBuilderConfiguration { layerCount++; } return conf; + + */ } /** @@ -345,7 +353,7 @@ public class NeuralNetConfiguration extends NeuralNetBaseBuilderConfiguration { private static boolean handleLegacyWeightInitFromJson(String json, LayerConfiguration l, ObjectMapper mapper, JsonNode confs, int layerCount) { - if ((l instanceof BaseLayerConfiguration) && ((BaseLayerConfiguration) l).getWeightInit() == null) { + if ((l instanceof BaseLayerConfiguration) ) { //&& ((BaseLayerConfiguration) l).getWeightInit() == null) { try { JsonNode jsonNode = mapper.readTree(json); if (confs == null) {