jupyter中tensorflow的tf.summary.merge_all()的问题

问题:在jupyter下采用tf.summary.merge_all() 会出现以下问题。


InvalidArgumentError (see above for traceback): You must feed a value for placeholder tensor 'inputs/x' with dtype float and shape [?,1]
	 [[Node: inputs/x = Placeholder[dtype=DT_FLOAT, shape=[?,1], _device="/job:localhost/replica:0/task:0/cpu:0"]()]]

参照网址:https://stackoverflow.com/questions/35114376/error-when-computing-summaries-in-tensorflow
中部分网友解答。

From your error message, it looks like you are using IPython. One pitfall when using IPython to build a TensorFlow model is that functions like tf.merge_all_summaries() will remember every summary created in the current session, including cells that failed with an error. This is a result of TensorFlow using a default graph to collect all of the operations, summaries, etc. that are created in a process, unless you specify the graph explicitly. I suspect that your call to tf.merge_all_summaries() is returning more than the three histogram summaries that you created in your code, and the older ones will have a dependency on a previously created placeholder.

 

得到的解决方案如下:上述中提到like tf.merge_all_summaries() will remember every summary created in the current session, including cells that failed with an error.

因此运行之前restart kernel 即可。

 

你可能感兴趣的:(tensorflow,tensorboard,jupyter)