# Week1: Dinosaur Sample() Step 4 instruction clarifications

Can someone please explain what I’m supposed to do in step 4? The instructions and the code comments are confusing to me.

Here it appears I’ve to override x. Does it mean I’ve to reset x to np.zeros() of shape characters? Or is it saying I need to make a one hot vector from x<t+1>?

- **Step 4**: Update to $x^{\langle t \rangle }$
- The last step to implement in sample() is to update the variable x, which currently stores $x^{\langle t \rangle }$, with the value of $x^{\langle t + 1 \rangle }$.
- You will represent $x^{\langle t + 1 \rangle }$ by creating a one-hot vector corresponding to the character that you have chosen as your prediction.
- You will then forward propagate $x^{\langle t + 1 \rangle }$ in Step 1 and keep repeating the process until you get a "\n" character, indicating that you have reached the end of the dinosaur name.


Here is the instruction from sample() comments:
# Step 4: Overwrite the input x with one that corresponds to the sampled index idx.

Lastly, I don’t understand what I’m expected to set this first None to in “x[None] = None.” Any hints?

Thanks

1 Like

The second line tells you to creates a one-hot vector representing the character you sampled in Step 3 as ‘idx’.
So, first create ‘x’ as a vector of all zeros of the size of the vocabulary.
Then set the “idx” element of ‘x’ to 1.

2 Likes