NLP C4_W1: Decoder pre_attention_rnn input dimension mismatch with embeddings output x

The embedding layer output has dimension 4 but pre_attention_rnn expects 3:


What do I miss?

your input dim is incorrect, it is not vocab_size+1, read the instructions again carefully. Remember it is endcoder-decoder architecture where it converts the sentences into token, encodes, then decoders and uses in translator to detect the next word or next token. The translator model uses here English to Portuguese words and has same set of vocab size, so adding +1 is creating an extra dimension for decoder to throw this error.

No, it’s not about the input_dim. Having +1 or not should be in principal aligned with the design principal of the Embedding layer (https://www.tensorflow.org/api_docs/python/tf/keras/layers/Embedding). Having said that, this does NOT fix the error at all.

You have created multiple posts for the same assignment starting from exercise 1, and will have to see all the codes.

when I mentioned input dim, it was related to encoder grade function and not exercise 3.

Page 47 of C4_W1.pdf

please send screenshot of your codes by personal DM