Traceback (most recent call last):
File "CNN2.py", line 272, in <module>
_, l, predictions = session.run([optimizer, cost, y_pred], feed_dict=feed_dict)
File "/Users/Aldo/tensorflow/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 778, in run
run_metadata_ptr)
File "/Users/Aldo/tensorflow/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 961, in _run
% (np_val.shape, subfeed_t.name, str(subfeed_t.get_shape())))
ValueError: Cannot feed value of shape (128,) for Tensor 'y_true:0', which has shape '(128, 1)'
答案 0 :(得分:0)
您可以将标签值重新整形为(128, 1)
labels = np.reshape(labels, (128, 1))
feed_dict = {..., y_true:labels}