Reputation: 1
I have this simple layer for my model
states = Input(shape=(len(inputFinal),))
This should generate a (328,None) but dunno why when I check is inverted
model.inputs
[<tf.Tensor 'input_1:0' shape=(None, 328) dtype=float32>]
And when I try to pass data to the model the layer is not correct
value.shape
(328,)
model.predict(value)
Input 0 of layer dense is incompatible with the layer: expected axis -1 of input shape to have value 328 but received input with shape [None, 1]
I cannot find the problem, any ideas ?
Upvotes: 0
Views: 516
Reputation: 36704
When specifying the input shape, you only need to specify the number of features. Keras doesn't want to know the number of sample because it can accept any size. So, when you do this:
states = Input(shape=(len(inputFinal),))
You're telling Keras that your input has 328 columns, which isn't the case. Keras realizes this when you feed the input, and crashes.
If inputFinal
is a 2D NumPy array, try:
Input(shape=inputFinal.shape[1:])
Upvotes: 1