Reputation: 25
I am receiving an error while running the below code:
model = tf.keras.Sequential([
tf.keras.layers.Embedding(vocab_size, embedding_dim, input_length=max_length),
tf.keras.layers.Conv1D(128, 5, activation='relu'),
tf.keras.layers.GlobalAveragePooling1D(),
tf.keras.layers.LSTM(32),
tf.keras.layers.Dense(6, activation='relu'),
tf.keras.layers.Dense(2, activation='sigmoid')
])
Error:
ValueError: Input 0 of layer lstm_13 is incompatible with the layer: expected ndim=3, found ndim=2. Full shape received: [None, 128]
Upvotes: 0
Views: 179
Reputation: 22031
change tf.keras.layers.GlobalAveragePooling1D()
with tf.keras.layers.AveragePooling1D()
Upvotes: 1