TensorFlow-无效的参数:送入和获取了Reshape:0 [英] TensorFlow - Invalid argument: Reshape:0 is both fed and fetched
本文介绍了TensorFlow-无效的参数:送入和获取了Reshape:0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法在Tensorflow中提供和获取相同的变量?如果没有,为什么不允许这样做?
Is there a way to both feed and fetch the same variable in Tensorflow? If not, why is this not allowed?
我收到此错误:
StatusNotOK: Invalid argument: Reshape:0 is both fed and fetched.
推荐答案
您不能同时获取和获取张量.解决方法是添加"tf.identity" op并获取该
You can not have a Tensor that is both fed and fetched. The work-around is to add "tf.identity" op and fetch that
tf.reset_default_graph()
a = tf.placeholder(tf.int32)
a_copy = tf.identity(a)
sess = tf.InteractiveSession()
sess.run(a_copy, feed_dict={a:1})
这篇关于TensorFlow-无效的参数:送入和获取了Reshape:0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文