C5W1A2 Dinosaurus - model() - idx initialisation

I constantly get the wrong output of the model. I’ve already found out it’s a problem with the initialisation of idx inside a loop.
My code is:

idx = (j + 1) % vocab_size

what is wrong with it?

I believe this is W1A2. So, the title must be C5W1A2. :slight_smile:

Anyway, I assume that you are discussing about an implementation for "model().

There is a list of examples which contain dinosaur names.
During optimization (iterations), we use one single example for one iteration. But, the number of iteration is far larger than the number of examples. So, key variables are, num_iteration and len(examples), and how we consider the lap around condition. Like you did, it is calculated by using modulo function. But, what we need to care is an “iteration count”, which is now “j” for a particular iteration, and the length of examples, for creating an index, idx.

Hope this helps.

1 Like