1. 程式人生 > >TensorBoard報錯:InvalidArgumentError: You must feed a value for placeholder tensor 'inputs/x_input' wi

TensorBoard報錯:InvalidArgumentError: You must feed a value for placeholder tensor 'inputs/x_input' wi

InvalidArgumentError: You must feed a value for placeholder tensor ‘inputs/x_input’ with dtype float

 [[Node: inputs/x_input = Placeholder[dtype=DT_FLOAT, shape=[], _device="/job:localhost/replica:0/task:0/cpu:0"]()]]

在使用TensorBoard進行視覺化的時候,出現了上面描述的錯誤。這個錯誤和dtype沒有關係。目前個人理解為是當前路徑下不能存在一個以上的events檔案。解決方案有以下幾個:
1. 到儲存的路徑下把之前生成的檔案給刪了;
2. 引用自別人的評論:

if you’re using IPython or Jupyter, it’ll cause that problem after running repeatedly.

there are two main ways that you could fix that:
A.

tf.reset_default_graph()

call firstly, before your tf operations code

B.
using

     with tf.Graph().as_default() as g:
             # your tf operations code