I gave it to the placeholder of tensorflow, but if the shape is different, I get scolded.

Asked 2 years ago, Updated 2 years ago, 54 views

MNIST handwritten character recognition with two layers of NN
Here's the code: gist
If you run summary_op in the 12th Cell if, the error will fail.
Is the shape of x(name=input_x) strange?That seems to be the case, but it can't be so, so I'm worried.
In addition, when you restart and run the kernel, the first run works without causing any errors, but the second run always fails there.

As for the environment, tensorflow 1.12.0, python 3.6.8, ipython 7.3.0, conda 4.5.12.

There was a question that seemed to be a similar error, but it didn't seem to be resolved, so I asked you a question.

python tensorflow

2022-09-30 19:33

1 Answers

I don't know tf.summary at all, but if you run the cells that make the calculation graph more than once,

tf.summary.scalar("loss", loss)

Several similar graphs have been created, and all of them have been put together

summary_op=tf.summary.merge_all()

So I think you are confused.If you reset the graph before you start creating the calculation graph, you can run this cell more than once.

tf.reset_default_graph()

# Number of input layer neurons 28*28=784, variable number of lines
x = tf.placeholder (tf.float32, [None,784], name = "input_x")


2022-09-30 19:33

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.