Reputation: 2363
I am trying to convert a one-dimensional array into a TF matrix, for use in a convolutional network, similar to how its done in the TF deep MNIST example, by using tf.reshape()
:
X = tf.placeholder(tf.float32, [None, 480])
X = tf.reshape(X, shape=[-1, 60, 8, 1])
I am getting the following error:
ValueError: Cannot feed value of shape (5, 480) for Tensor 'Reshape_1:0', which has shape '(?, 60, 8, 1)'
5 is my batch_size
and 480 is the length of the original array. I want to convert it into a 60x8 tensor, plus 1 output channel, so I am following with the TF MNIST example of using the target shape of [-1, 60, 8, 1]
.
Upvotes: 2
Views: 906
Reputation: 2364
On your first line of code you define a placeholder and store it in the python variable X. On the second line of code you define a reshape operator and also store it in the python variable X. You have now overwritten the previous value of X and lost access to the placeholder. You are trying to feed in a value to the placeholder but you are actually feeding it to the reshape operator. If you use different names for these variables then you will not see this error.
Upvotes: 2