Skip to content Skip to sidebar Skip to footer

Value Error While Feeding In Neural Network

I have programmed a multi-layer neural network but I'm getting an error while feeding my dimension into it. I'm getting a Value Error. Here is The Code: import pandas as pd import

Solution 1:

You're right, you just have to reshape your input values in order to make them compatible with the placeholder's shape.

Your placeholder has shape (?,41) that means any batch size, with 41 values. Your input is, instead, with a shape of 41.

It's clear that the batch dimension is missing. Just add a 1 dimension to your input and you'll be fine:

batch_x = np.expand_dims(np.array(feature.iloc[i, :].values.tolist()), axis=0)

Note that probably you have to add a 1 dimension to your batch_y variable too. (for the same reason described above)

Solution 2:

Your data format is incompatible with the placeholder defined as

X=tf.placeholder(tf.float32,[None,41])

It is probably easier to reformat your data which you feed during training/evaluation. I don't see where you import it but you are going to need to either reshape or swap axes so that it has format (index, 41) and not (41, index)

Post a Comment for "Value Error While Feeding In Neural Network"