'ValueError: Error when checking input: expected embedding_input to have 2 dimensions, but got array with shape (298, 200, 1)

I got a following error and could not find any solution when I train BiLSTM model.

ValueError: Error when checking input: expected embedding_input to have 2 dimensions, but got array with shape (298, 200, 1)

The below is the architecture built in my project. Please, help me.

    model.add(tf.keras.layers.Embedding(input_dim=n_vocab, output_dim=128, batch_input_shape=(maxlen, 1)))
    model.add(tf.keras.layers.Bidirectional(tf.keras.layers.LSTM(64)))
    model.add(tf.keras.layers.Dropout(0.5))
    model.add(tf.keras.layers.Dense(n_vocab, activation='sigmoid'))```


Sources

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

Source: Stack Overflow

Solution Source