Tensorflow: Placeholder Size Issue in Tutorial

I'm followingTensorflow's Deep MNIST tutorial. When I ran the following line

train_step.run(feed_dict={x: batch[0], y_: batch[1]})

I get the following error

ValueError: Cannot feed value of shape (50, 784) for Tensor 'Placeholder:0', which has shape '(?, 748)'

It seem unhappy with how I'm feedingx. I setxto be the following placeholder:

x = tf.placeholder(tf.float32, shape=[None, 748])

I checked thatbatch[0]is a float32 numpy array of size 50x748. What's the proper way of feeding an array tox?

This is just a typo in your placeholder, notice

Cannot feed value of shape (50, 784) for Tensor 'Placeholder:0', which has shape '(?, 748)'

It's shape 784 in the feed, while the placeholder is 748, so you just need to change the placeholder to

x = tf.placeholder(tf.float32, shape=[None, 784])

Also don't worry this happens to everyone :)

Tags: tensorflow
What Others Are Reading