Fixing tests

Signed-off-by: brian <brian@brutex.de>
enhance-build-infrastructure
Brian Rosenberger 2023-05-08 16:46:18 +02:00
parent 0ba049885f
commit 2c8c6d9624
1 changed files with 10 additions and 2 deletions

View File

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