C4W1_assignment - Class Encoder

When creating a post, Hi - Appreciate any help on this… this is for C4W1 (NLP)

i’m getting the below error

ValueError: Exception encountered when calling layer ‘encoder’ (type Encoder).

Input 0 of layer “bidirectional” is incompatible with the layer: expected ndim=3, found ndim=2. Full shape received: (64, 14)

Call arguments received by layer ‘encoder’ (type Encoder):
• context=tf.Tensor(shape=(64, 14), dtype=int64)

The shape of the input to the encoder needs be 3 dimensional and the error says its 2 dimensional! Check what is the size of the input…


Hi @Manjunath_RN

Make sure you implemented the Embedding layer.

Also, make sure that you pass the input (context) to the embedding layer.

Then, make sure that you pass the output of the embedding layer (x) to the rnn (not the context).



Thank you! That was it… was right in code comments !

1 Like