From 2a1ea2478149b60b06345870824546784b01baee Mon Sep 17 00:00:00 2001 From: jxtps Date: Tue, 18 Jun 2019 20:22:07 -0700 Subject: [PATCH] Add thousand-separator commas to TotalParams (#7915) * Add thousand-separator commas to TotalParams The number of parameters can be quite large, and it would help the reading of the summary printout to have the TotalParams column & values at the bottom have thousand-separator-commas in them. * Add thousand-separator commas to MultiLayerNetwork Corresponding change to MultiLayerNetwork Signed-off-by: Jxtps Jxtps --- .../org/deeplearning4j/nn/graph/ComputationGraph.java | 8 ++++---- .../deeplearning4j/nn/multilayer/MultiLayerNetwork.java | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java b/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java index d08fa852a..a0c4bc22a 100755 --- a/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java +++ b/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java @@ -4265,7 +4265,7 @@ public class ComputationGraph implements Serializable, Model, NeuralNetwork { Layer currentLayer = ((LayerVertex) currentVertex).getLayer(); classNameArr = currentLayer.getClass().getName().split("\\."); className = classNameArr[classNameArr.length - 1]; - paramCount = String.valueOf(currentLayer.numParams()); + paramCount = String.format("%,d", currentLayer.numParams()); //layer with params if (currentLayer.numParams() > 0) { paramShape = ""; @@ -4372,9 +4372,9 @@ public class ComputationGraph implements Serializable, Model, NeuralNetwork { } ret.append(StringUtils.repeat("-", totalLength)) - .append(String.format("\n%30s %d", "Total Parameters: ", params().length())) - .append(String.format("\n%30s %d", "Trainable Parameters: ", params().length() - frozenParams)) - .append(String.format("\n%30s %d", "Frozen Parameters: ", frozenParams)) + .append(String.format("\n%30s %,d", "Total Parameters: ", params().length())) + .append(String.format("\n%30s %,d", "Trainable Parameters: ", params().length() - frozenParams)) + .append(String.format("\n%30s %,d", "Frozen Parameters: ", frozenParams)) .append("\n") .append(StringUtils.repeat("=", totalLength)) .append("\n"); diff --git a/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/multilayer/MultiLayerNetwork.java b/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/multilayer/MultiLayerNetwork.java index 6f43dc986..0436bd244 100755 --- a/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/multilayer/MultiLayerNetwork.java +++ b/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/multilayer/MultiLayerNetwork.java @@ -3553,7 +3553,7 @@ public class MultiLayerNetwork implements Serializable, Classifier, Layer, Neura String out = "-"; String[] classNameArr = currentLayer.getClass().getName().split("\\."); String className = classNameArr[classNameArr.length - 1]; - String paramCount = String.valueOf(currentLayer.numParams()); + String paramCount = String.format("%,d", currentLayer.numParams()); String inShape = ""; String outShape = ""; InputPreProcessor preProcessor; @@ -3640,9 +3640,9 @@ public class MultiLayerNetwork implements Serializable, Classifier, Layer, Neura } ret.append(StringUtils.repeat("-", totalLength)); - ret.append(String.format("\n%30s %d", "Total Parameters: ", params().length())); - ret.append(String.format("\n%30s %d", "Trainable Parameters: ", params().length() - frozenParams)); - ret.append(String.format("\n%30s %d", "Frozen Parameters: ", frozenParams)); + ret.append(String.format("\n%30s %,d", "Total Parameters: ", params().length())); + ret.append(String.format("\n%30s %,d", "Trainable Parameters: ", params().length() - frozenParams)); + ret.append(String.format("\n%30s %,d", "Frozen Parameters: ", frozenParams)); ret.append("\n"); ret.append(StringUtils.repeat("=", totalLength)); ret.append("\n");