C5W1Exercise 6 - rnn_backward

may i ask any wrong with dWaa += dWaat ?
i didn’t get why this erroe happend


ValueError Traceback (most recent call last)
in
11 a_tmp, y_tmp, caches_tmp = rnn_forward(x_tmp, a0_tmp, parameters_tmp)
12 da_tmp = np.random.randn(5, 10, 4)
—> 13 gradients_tmp = rnn_backward(da_tmp, caches_tmp)
14
15 print(“gradients[“dx”][1][2] =”, gradients_tmp[“dx”][1][2])

in rnn_backward(da, caches)
45 dx[:, :, t] = dxt
46 dWax += dWaxt
—> 47 dWaa += dWaat
48 dba += dbat
49

ValueError: operands could not be broadcast together with shapes (5,5) (10,10) (5,5)

Hey @Lucy_Hui,
The error is not in the indicated line of code. The error is in either your retrieval of dWaat from the gradients dict, or either in the calculations of gradients, i.e., in the rnn_cell_backward function, with higher probability of the error being in the second. I would suggest you to go through the implementation of rnn_cell_backward function very carefully, and see if there is perhaps some typo, as a result of which it is using some global variable or something else.

Still, if you are unable to figure out the error, DM your code to me. I hope this helps.

Regards,
Elemento