出现这个错误是因为3920000不等于100*28*28*1
所以只要把100改成5000就行了。
如果你编的程序和我一样,那么相关代码可以这么写
mnist.validation.images.shape[0]就是5000
x = tf.compat.v1.placeholder(tf.float32,
[mnist.validation.images.shape[0], mnist_inference_Lenet5_update.IMAGE_SIZE,
mnist_inference_Lenet5_update.IMAGE_SIZE,
mnist_inference_Lenet5_update.NUM_CHANNELS]
, name='x-input')
y_ = tf.compat.v1.placeholder(tf.float32, [None, mnist_inference_Lenet5_update.OUTPUT_NODE], name='y-input')
xs = mnist.validation.images
reshaped_xs = np.reshape(xs, (
mnist.validation.images.shape[0], mnist_inference_Lenet5_update.IMAGE_SIZE, mnist_inference_Lenet5_update.IMAGE_SIZE,
mnist_inference_Lenet5_update.NUM_CHANNELS))
validate_feed = {x: reshaped_xs, y_: mnist.validation.labels}
y = mnist_inference_Lenet5_update.inference(x, False, None)