Week 1: Building_a_Recurrent_Neural_Network_Step_by_Step : Exercise 2- rnn_forward

I am not understanding why I am getting wrong values for ‘a’.

1 Like

Note that the initial value for a_next does not come from the zero filled a that you just created. It is the argument a0 that is passed in to the function.

Once you get this to work, please edit your original post to remove the source code. It helps to see the code for debugging purposes, but we don’t want to leave it sitting around on the forums. Thanks!


Thanks for the help! Unfortunately, I am still not getting the right answer. This time I am not getting the correct ‘y_pred’ values. It should be straightforward but I can’t figure it out. Some help would very much be appreciated!

Perhaps there is an error in your rnn_cell_forward() function.

1 Like

I checked it multiple times and I still can’t find it.

And it is telling me values are not correct.

Hi @stirom,

The input for the np.dot in the softmax statement is incorrect. It should be (Wya, a_next) because you need the newly computed hidden state, a_next, to call the softmax function. Please check the formula showed in Fig 2, and point 2 of the instruction note.