C3W1_RNNs - Unable to understand the illustration of error within the notebook

As shown in the image below, it raises an error when vector length was changed from 40 to 44.

However it does not raise the error when the same is done in the case of batch_size and sequence_length

I am not able to grasp why it did not change to None by the sequential model as it did for batch_size and sequence_length?

Because you have defined the input.shape with the output you have got, you need to define the input shape according to arguments required and not numerical value

Hi Deepti,

Appreciate your response, however I am still not able to grasp the concept. Can you please elaborate more on this?

How have you defined your input or input.shape in grade cell is creating this error.

Can you DM the previous grade cell code as screenshot. Click on my name and then message

For the model_GRU:

  • the batch_size and sequence_length are dimensions that can vary, and the model can handle their changes flexibly. That’s because they don’t affect the model’s architecture
  • word_vector_length is a fixed dimension that the first layer expects; changing it requires rebuilding the model. That’s because changing word_vector_length directly impacts the number of weights in the first layer.
1 Like

Hi Raphael,

Appreciate your response but isn’t the word_vector_length variable is word embedding size and word embedding size is considered as one of the hyperparameter for the model so it would be flexible right?


have you selected the right week for the issue you are having? can you mention the assignment name?

In case this is Deep N-grams assignment, I am doubting if you are using any obsolete copy. Kindly make sure you have updated your lab before you start any assignment for course 3 and course 4 of this specialisation.

I could find the screenshot image you are mentioning, so clearly mention assignment name always in your query.


Hi @Karan_Bari ,

As Raphael mentioned, if you want to change the embedding size of your input, you need to reinitialize your model to know how big its weight matrix needs to be. This means rebuilding the GRU model.
In the exercise, what is shown is varying input during forward pass. At this point the model has already been built and set to have 40 as its feature size and thus dictating its weight matrix.size.

1 Like