Skip to content

Commit 9573a4c

Browse files
committed
Revert "remove Identity block"
This reverts commit 694886f.
1 parent 694886f commit 9573a4c

File tree

3 files changed

+3
-9
lines changed

3 files changed

+3
-9
lines changed

examples/mnist/expected_values.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.0609893e-06, 1.1228256e-07, 4.821958e-05, 0.00013738014, 4.2588137e-09, 2.3615916e-05, 1.6721445e-10, 0.99975353, 7.9972335e-07, 3.221138e-05
1+
1.8487935e-05, 5.188386e-08, 0.0003525585, 0.0014435184, 3.3050244e-07, 3.180701e-05, 2.4361995e-08, 0.9980293, 1.7698758e-05, 0.00010610428

examples/mnist/mnist.py

+2-8
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,9 @@ def probability_model(x):
5858
assert_array_equal(expected, tf_model_output)
5959
assert_array_equal(expected, frozen_model_output[0])
6060

61-
# Remove `Identity` operation
62-
# # TODO Check whether the last identity operation is actualy required
63-
frozen_model_graph_def = frozen_model.graph.as_graph_def()
64-
optimized_graph_def = tf.Graph().as_graph_def()
65-
optimized_graph_def.node.extend(frozen_model_graph_def.node[:-1])
66-
6761
# write the computation graph and weights
6862
directory = "examples/mnist"
69-
tf.io.write_graph(optimized_graph_def, directory, "model.pb", as_text=False)
63+
tf.io.write_graph(frozen_model.graph, directory, "model.pb", as_text=False)
7064

7165
# dump expected values to compare Rust's outputs
7266
with open("examples/mnist/expected_values.txt", "w") as f:
@@ -77,4 +71,4 @@ def probability_model(x):
7771
logdir = "logs/mnist"
7872
writer = tf.summary.create_file_writer(logdir)
7973
with writer.as_default():
80-
tf.summary.graph(optimized_graph_def)
74+
tf.summary.graph(frozen_model.graph)

examples/mnist/model.pb

218 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)