Programming Assignment: Building your Recurrent Neural Network - Step by Step - Exersize 6

Hello,
I have a problem in exercise 6. My output doesn’t match the expected output.

My output is
gradients[“dx”][1][2] = [0.04036334 0.01590669 0.00395097 0.01483317]

Expected output is
gradients[“dx”][1][2]= [-2.07101689 -0.59255627 0.02466855 0.01483317]

[code removed - moderator]

Here are some hints:

  1. Initialization of da_prevt is incorrect.
  2. The 1st parameter to rnn_cell_backward is incorrect. Remember that iteration starts from the end. Using just da_prevt is incomplete. You should also consider the upstream gradients of all hidden states.