【发布时间】:2019-04-12 15:47:22
【问题描述】:
我对如何使用占位符进行批量训练感到困惑。在我的代码中,输入图像的大小为 3 x 3。为了进行批量训练,我设置了 tf.placeholder(tf.float32,shape=[None,3,3])。
当我尝试将 3x3 批次作为输入时,TensorFlow 给出的错误是
Cannot feed value of shape (3, 3) for Tensor u'Placeholder_1:0', which has shape '(?, 3, 3).
下面是代码
input = np.array([[1,1,1],[1,1,1],[1,1,1]])
placeholder = tf.placeholder(tf.float32,shape=[None,3,3])
init = tf.global_variables_initializer()
with tf.Session() as sess:
sess.run(init)
sess.run(placeholder, feed_dict{placeholder:input})
【问题讨论】:
标签: tensorflow input batchsize