ValueError: Cannot feed value of shape (64, 10) for Tensor u'Placeholder_1:0', whichhas shape '(10,

报错如下:
Traceback (most recent call last):
File “…/”, line 69, in
sess.run(optimizer, feed_dict={x: batch_xs, y: batch_ys, keep_prob: dropout})
File “…/python2.7/site-packages/tensorflow/python/client/session.py”,line 895, in run
run_metadata_ptr)
File “…/python2.7/site-packages/tensorflow/python/client/session.py”,line 1100, in _run
% (np_val.shape, subfeed_t.name, str(subfeed_t.get_shape())))
ValueError: Cannot feed value of shape (64, 10) for Tensor u’Placeholder_1:0’, whichhas shape ‘(10, ?)’

错误代码:

y = tf.placeholder(tf.float32, {None, n_classes})

修改为

y = tf.placeholder(tf.float32, [None, n_classes])

你可能感兴趣的:(问题解决)