Building_a_Recurrent_Neural_Network_Step_by_Step-Exercize 2

Hello ! I’m getting this error when running the function !

Perhaps your code in rnn_forward() that sets the initial a_next variable is incorrect.

Or maybe there is a problem in your rnn_cell_forward() function.

Hello TMosh ! Thank you for answering me , but the cond in the rnn_cell_forward() looks good and all the tests past here !

{moderator edit - solution code removed}

Maybe you are making a mistake in the below code:

# initialize "a" and "y_pred" with zeros (≈2 lines)
a = None
y_pred = None
  
# Initialize a_next (≈1 line)
a_next = None

Note that:

a -- Hidden states for every time-step, numpy array of shape (n_a, m, T_x)
y_pred -- Predictions for every time-step, numpy array of shape (n_y, m, T_x)

And:

  • Initialize the 2D hidden state a_next by setting it equal to the initial hidden state, a_0

Hello ! I found the error ! a was initialised as a=np.zeros([n_x,…) istead of ([n_a … ) . Thank you !!