'Model layer is not compatible

ValueError: Input 0 of layer "model" is incompatible with the layer: expected shape=(None, 238), found shape=(None, 30, 1662)

I have this error. So I read that I need to fix my model definition. I tried to change my parameter, however, I keep stuck with the same problem

This is my model

tf.keras.backend.clear_session()
from tensorflow.keras.layers import Embedding, LSTM, Dense, Bidirectional
from tensorflow.keras import Input, Model

input1 = Input(shape=(maxlen,))
X = Embedding(vocab_size, 64)(input1)
X = LSTM(64)(X)
out = Dense(1, activation='relu')(X)

model = Model(inputs=[input1], outputs=[out])
model.summary()

I use maxlen as my dataset has different sizes per class with max length of 521



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source