我有一个占位符,形状为(?, 128, 128, 1)
net_input = tf.placeholder(tf.float32, shape=[None, 128, 128, 1])
然后,我使用形状为(32, 128, 128, 1)
的numpy数组来填充上述占位符:
input_image_batch = input_image_batch.reshape(32, 128, 128, 1)
pre_output_image = sess.run(network, feed_dict={net_input: input_image_batch})
它给了我这个错误:
ValueError: Cannot feed value of shape (32, 128, 128) for Tensor 'Placeholder_1:0', which has shape '(?, 128, 128, 1)'
我打印了input_image_batch的形状,没问题。
print(input_image_batch.shape)
(32, 128, 128, 1)
TensorFlow可能会在进给时自动挤压最后一个轴,并且不知道为什么TensorFlow 1.13
版本进行此处理?