parent
0ba049885f
commit
2c8c6d9624
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue