Skip to content Skip to sidebar Skip to footer

Input Dense Is Incompatible With The Layer Invalid Shape

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 [

Solution 1:

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:])

Post a Comment for "Input Dense Is Incompatible With The Layer Invalid Shape"