C5W1 Dinosaurs assignment Sample function

Hi, I’ve been revising my implementation of the Sample() function for hours and could not figure out why I am getting the following error when testing it:

list of sampled indices:
[23, 16, 4, 16, 4, 16, 0]
list of sampled characters:
[‘w’, ‘p’, ‘d’, ‘p’, ‘d’, ‘p’, ‘\n’]

AssertionError Traceback (most recent call last)
19 print(“\033[92mAll tests passed!”)
—> 21 sample_test(sample)

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”
19 print(“\033[92mAll tests passed!”)

AssertionError: Wrong values

Would someone help me?

There are a whole lot of possible causes.


Update: Be sure that when you compute a dot product, that you don’t also compute the sum separately. The dot product automatically computes the sum of the products.