Placeholder_2:0 is both fed and fetched

前端 未结 2 1096
醉话见心
醉话见心 2021-01-12 06:02

When I run this code:

x = tf.placeholder(tf.int32, shape=(None, 3))
with tf.Session() as sess: 
    feed_dict = dict()
    feed_dict[x] = np.array([[1,2,3],         


        
2条回答
  •  执笔经年
    2021-01-12 06:44

    I found out what I was doing wrong.

    x is a placeholder -- it holds information and evaluating x does not do anything. I forgot that vital piece of information and proceeded to attempt to run the Tensor x inside sess.run()

    Code similar to this would work if, say, there was another Tensor y that depended on x and I ran that like sess.run([y], feed_dict=feed_dict)

提交回复
热议问题