I get the value error a and I don’t understand why. I have checked a couple times, but I still don’t understand the problem. I have also tried avoiding passing by reference by using 1.0*var when passing things into functions, but that doesn’t change the outcome.
The rnn_forward() function calls rnn_cell_forward() to calculate the values of ‘a’. Did your code for rnn_cell_forward() pass the unit test? If not, the error will propagate to the rnn_forward() function. Please check the rnn_cell_forward() function, making sure your code follows the formula given in the instructions.
If your rnn_cell_forward is correct, then the next thing to check is how you initialize a_next in rnn_forward before you start the main loop. One common mistake is to initialize it to zeros of the appropriate shape, but notice that one of the arguments to rnn_forward is a0.
Here’s what I get if I make that mistake on purpose: