Skip to content Skip to sidebar Skip to footer

Valueerror: Cannot Feed Value Of Shape (784,) For Tensor 'x:0', Which Has Shape '(?, 784)'

This is my first experience with Tensorflow. There appears to be many queries to this ValueError, however I am not getting any relief. I am using the notMNIST dataset, which is spl

Solution 1:

Your tensors do have mixed up shapes. You feed a tensor where the batch index is at the end into a tensor where the batch index is at the front.

Do x_batch = numpy.swapaxes(x_batch, 1, 0) before feeding the tensor.

Solution 2:

On this line, you're referring to inputs and labels

sess.run(training_op, feed_dict={inputs: x_batch, labels: y_batch})

Where as on the lines below,

summary_train,acc_train=sess.run([merged,accuracy],feed_dict={x:x_batch,y:y_batch})summary_test,acc_test=sess.run([accuracy_summary,accuracy],feed_dict={x:x_test,y:y_test})

you're referring to x and y. Change these to be the same. I.e. it should be the same value as your placeholder variables. (inputs and labels)

Post a Comment for "Valueerror: Cannot Feed Value Of Shape (784,) For Tensor 'x:0', Which Has Shape '(?, 784)'"