Hello all,
I’m stuck on the 2nd programming exercise in DLS 5 ( Dinosaur Island-Character-Level Language Modeling). The problem occurs in UNQ_C2 - sample() There are no runtime errors, but the final assertion fails as shown below:
AssertionError Traceback (most recent call last)
<ipython-input-91-a13d660e654a> in <module>
19 print("\033[92mAll tests passed!")
20
---> 21 sample_test(sample)
<ipython-input-91-a13d660e654a> in sample_test(target)
15 assert indices[-1] == char_to_ix['\n'], "All samples must end with \\n"
16 assert min(indices) >= 0 and max(indices) < len(char_to_ix), f"Sampled indexes must be between 0 and len(char_to_ix)={len(char_to_ix)}"
---> 17 assert np.allclose(indices[0:6], [23, 16, 26, 26, 24, 3]), "Wrong values"
18
19 print("\033[92mAll tests passed!")
AssertionError: Wrong values
Here’s my code for the sample() function
{mentor edit: code removed
I’ve checked multiple times that the equations a, z and y match up with the instructions, and they do, so I don’t understand why I’m getting a different answer from the grader. Any help would be appreciated!
Thanks!