DLS Course 5, week 1, assignment 2: Dino

I got assertion error for the Dino assignment for the model function. I am not understanding the instruction about “Create the list of input characters: X”. I don’t see any flag in rnn_foreward function but the instructions says it uses None value as a flag to set the input vector as a zero vector. So I am not sure how to set the input X. I used X = single_example_ix but it did not seem to work.

Any help would be greatly appreciated.


I have resolved this. Thanks!

Hi @cchen,

This is taken from the instruction note:

Create the list of input characters: X
  • rnn_forward uses the None value as a flag to set the input vector as a zero-vector.
  • Prepend the list [ None ] in front of the list of input characters.
  • There is more than one way to prepend a value to a list. One way is to add two lists together: ['a'] + ['b']

So, what you do is to put [None] + [ char_to_ix[c] for c in single_example_chars]

Yes that worked. Thank you!

@cchen would you please help me! I got an assertion too and all looks good to me. I have the following:

j = 0 idx = 0
single_example = turiasaurus
single_example_chars [‘t’, ‘u’, ‘r’, ‘i’, ‘a’, ‘s’, ‘a’, ‘u’, ‘r’, ‘u’, ‘s’]
single_example_ix [20, 21, 18, 9, 1, 19, 1, 21, 18, 21, 19]
X = [None, 20, 21, 18, 9, 1, 19, 1, 21, 18, 21, 19]
Y = [20, 21, 18, 9, 1, 19, 1, 21, 18, 21, 19, 0]

I understand this issue has been resolved.

Hi @Kic , @TMosh, @carlosrv19,

I am getting assertion error after doing all steps as mentioned in the notebook and also following instructions in this thread. I am not able to find out what is issue with the code. My suspicion is how I am setting the index value may not be correct but not sure. I would appreciate if you could please share your inputs regarding what I am missing/overlooking.

Thank you for your time!


Saying that you get an assertion error isn’t very helpful. Which assertion error?
It would be better if you post a copy of the stack trace, including the error message.

Hi @TMosh,

Thank you for your prompt response. Appreciate it.
Please ignore my message. I was able to fix issue with my code by following this thread of conversation - Error in week 1 assignment 2 last exercise - Deep Learning Specialization / DLS Course 5 - DeepLearning.AI

Thank you for your time!


Heads up for those not using coursera environment, the last test might fail. Cheers.