Tensorflow报错之一:InvalidArgumentError: You must feed a value for placeholder tensor 'inputs/x_input'
2018-03-03 11:38
3395 查看
D:\program\anaconda3\lib\site-packages\tensorflow\python\framework\errors_impl.py in __exit__(self, type_arg, value_arg, traceback_arg) 472 compat.as_text(c_api.TF_Message(self.status.status)), --> 473 c_api.TF_GetCode(self.status.status)) 474 # Delete the underlying status object from memory otherwise it stays alive InvalidArgumentError: You must feed a value for placeholder tensor 'Placeholder_1' with dtype float and shape [?,1] [[Node: Placeholder_1 = Placeholder[dtype=DT_FLOAT, shape=[?,1], _device="/job:localhost/replica:0/task:0/device:CPU:0"]()]] During handling of the above exception, another exception occurred: InvalidArgumentErrorTraceback (most recent call last) <ipython-input-71-abd8654a9e35> in <module>() 66 tf.global_variables_initializer().run() 67 for i in range(TRAINING_STEPS): ---> 68 sess.run(train_op, feed_dict={x: data, y_: label}) 69 if i % 2000 == 0: 70 print("After %d steps, loss: %f" % (i, sess.run(loss, feed_dict={x: data, y_: label})))
具体报错如上,经过验证加入tf.reset_default_graph(),问题解决
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"]()]]1
2
在使用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()1
call firstly, before your tf operations codeB.
using
with tf.Graph().as_default() as g: # your tf operations code1
2
For details, please refer https://stackoverflow.com/questions/35114376/error-when-computing-summaries-in-tensorflow如果有别的错误也可以参考这篇博文:
http://blog.csdn.net/u012436149/article/details/53894364
相关文章推荐
- TensorBoard报错:InvalidArgumentError: You must feed a value for placeholder tensor 'inputs/x_input' wi
- tensorflow.python.framework.errors.InvalidArgumentError: Input to reshape is a tensor with xxx value
- InvalidArgumentError (see above for traceback): logits and labels must be same size:
- Error 47 "xxxxxxx"is an invalid value for the "InputManifest" parameter of the "GenerateApplicationM
- errors_impl.InvalidArgumentError: Input to reshape is a tensor
- TensorFlow使用next_batch()读取/tensorflow.python.framework.errors_impl.InvalidArgumentError: Expect 3 fi
- tensorflow TypeError: run() got multiple values for argument 'feed_dict'
- tensorflow TypeError: run() got multiple values for argument 'feed_dict'
- SharePoint 2010 Error: You must specify a value for this required field
- Python ValueError: invalid literal for int() with base 10 实用解决方法
- java.lang.IllegalArgumentException: invalid value for field
- java.lang.IllegalArgumentException: Page directive: invalid value for import
- [Struts2] No result defined for action ... and result input & Invalid field value for field ...
- ValueError: invalid literal for int() with base 10
- ValueError: invalid literal for int() with base 10: '"iv'
- ImportError: Failed to import pydot. You must install pydot and graphviz for `pydotprint` to work.
- [Struts2] No result defined for action ... and result input & Invalid field value for field ...
- Jquery 报错 Uncaught InvalidStateError: Failed to set the 'value' property on 'HTMLInputElement':
- 【Ubuntu-Tensorflow】InvalidArgumentError GPU不能使用的问题
- Python-struct.error: argument for 's' must be a bytes object