C5_W1_A1_Exercise 2 - rnn_forward; How to store values in 3D tensor?

Hello. I’ve hit a brick wall trying to figure out how to complete this 1 line of code:

 # Save the value of the new "next" hidden state in a (≈1 line)
        a[:,:,t] = a[a_next[:,], a_next[,:], t]

My solution is horrendously wrong, but the correct syntax for accessing the values from the 2d tensor a_next is eluding me.

I understand that a has shape (𝑛𝑎,𝑚,𝑇𝑥) but how do I assign the values for (𝑛𝑎,𝑚) from a_next into a?

Any tips, hints, or advice would be appreciated.

If a.shape == (5, 10, 4), then, a_next.shape == (5, 10). When we want to update a at timestep t, only the last dimension should point to the timestep. Rest of the indices should be set to be compatible with a_next. Do not use a_next to index into a.

Thanks. I was seeing this completely backwards. I’ve solved it now.