Reputation: 61
Short question. Why caused this line to error? :
x = tf.placeholder_with_default([0.0 for _ in range(784)], [None, 784], name='images')
How can I fix it? Thanks in advance.
This error occurs:
ValueError: Shapes must be equal rank, but are 1 and 2 for 'images' (op: 'PlaceholderWithDefault') with input shapes: [784].
Upvotes: 1
Views: 687
Reputation: 2604
The problem is you make shape [None, 784] for the placeholder, but default value has shape [784]. So just add one more square bracket around default value, like:
x = tf.placeholder_with_default([[0.0 for _ in range(784)]], [None, 784], name='images')
So you have shape of [1,784]
Upvotes: 1