有没有办法在Tensorflow中提供和获取相同的变量?如果没有,为什么不允许这样做?
我收到了这个错误:
StatusNotOK: Invalid argument: Reshape:0 is both fed and fetched.
答案 0 :(得分:7)
你不能拥有一个既有馈送也有提取的Tensor。解决方法是添加" tf.identity" op和fetch
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})
答案 1 :(得分:0)
我刚刚意识到我的错误发生了,因为我在TensorFlow的弃用版本上运行。我仍然有兴趣了解变量如何在feed和fetch中出现!