public static void saveModel(FileSystem fs, Model model ) throws Exception{ String json = null; if (model instanceof MultiLayerNetwork) { json = ((MultiLayerNetwork)model).getLayerWiseConfigurations().toJson(); } else if (model instanceof ComputationGraph) { json = ((ComputationGraph)model).getConfiguration().toJson(); } byte [] byts = json.getBytes(); FSDataOutputStream out = fs.create(new Path(modelPath)); out.write(byts); out.hsync(); fs.close(); } }
@Override public String toString() { return toJson(); }
json = ((MultiLayerNetwork) model).getLayerWiseConfigurations().toJson(); } else if (model instanceof ComputationGraph) { json = ((ComputationGraph) model).getConfiguration().toJson();
} else if (model instanceof ComputationGraph) { ComputationGraph cg = ((ComputationGraph) model); jsonConf = cg.getConfiguration().toJson(); numLayers = cg.getNumLayers(); numParams = cg.numParams();
if (!rootDevice) { this.replicatedModel = new ComputationGraph(ComputationGraphConfiguration .fromJson(((ComputationGraph) protoModel).getConfiguration().toJson())); this.replicatedModel.init();
if (!rootDevice) { this.replicatedModel = new ComputationGraph(ComputationGraphConfiguration .fromJson(((ComputationGraph) protoModel).getConfiguration().toJson())); this.replicatedModel.init();
if (!onRootModel) { ComputationGraphConfiguration conf = ComputationGraphConfiguration .fromJson(((ComputationGraph) originalModel).getConfiguration().toJson()); conf.setTrainingWorkspaceMode(workspaceMode);
if (!onRootModel) { ComputationGraphConfiguration conf = ComputationGraphConfiguration .fromJson(((ComputationGraph) originalModel).getConfiguration().toJson()); conf.setTrainingWorkspaceMode(workspaceMode);
numParams = cg.numParams(); numLayers = cg.getNumLayers(); modelConfigJson = cg.getConfiguration().toJson(); totalNumUpdates = cg.getConfiguration().getIterationCount(); } else {