DLS 5, Week 1, Assignment 2 - sample function

Hi,

In the first run of the sample function, the correct index and letter are calculated. Therefore I assume that the softmax calculation is correct. All further iterations differ from the expected output:

Sampling:
list of sampled indices:
[23, 15, 23, 22, 25, 5, 12, 20, 12, 20, 5, 6, 17, 1, 22, 25, 5, 0]
list of sampled characters:
[‘w’, ‘o’, ‘w’, ‘v’, ‘y’, ‘e’, ‘l’, ‘t’, ‘l’, ‘t’, ‘e’, ‘f’, ‘q’, ‘a’, ‘v’, ‘y’, ‘e’, ‘\n’]

AssertionError: Wrong values

Any suggestions?

Cheers,
Arno

1 Like

For the first run, all of the x values are preset to zeros.
For the later runs, only one of the x values should be set to 1.
So, start by checking your code for the "x[idx] = … " line.

2 Likes

I got it. You saved my day! :+1:
Thanks!

Thank you guys, 2 days stuck on this, I was assign y[idx] to x :confused: