Example usage for org.deeplearning4j.nn.conf NeuralNetConfiguration toJson

List of usage examples for org.deeplearning4j.nn.conf NeuralNetConfiguration toJson

Introduction

In this page you can find the example usage for org.deeplearning4j.nn.conf NeuralNetConfiguration toJson.

Prototype

public String toJson() 

Source Link

Document

Return this configuration as json

Usage

From source file:org.knime.ext.dl4j.base.util.DLModelPortObjectUtils.java

License:Open Source License

/**
 * Converts layers to list of Strings in json format.
 *
 * @param layers the list of layers to convert
 * @return the list of converted layers to json
 *//*from  w ww  . ja v  a  2 s.c  o  m*/
public static List<String> convertLayersToJSONs(final List<Layer> layers) {
    final List<String> allLayersAsJson = new ArrayList<>();
    final NeuralNetConfiguration config = new NeuralNetConfiguration();
    for (final Layer layer : layers) {
        config.setLayer(layer);
        allLayersAsJson.add(config.toJson());
    }
    return allLayersAsJson;
}