Week1 assign1 exercise 2 RNN_forward

Please help me, I don’t know what part I got wrong…


AssertionError Traceback (most recent call last)
in
18
19 #UNIT TEST
—> 20 rnn_forward_test(rnn_forward)

~/work/W1A1/public_tests.py in rnn_forward_test(target)
78 assert len(caches[0]) == T_x, f"len(cache) must be T_x = {T_x}"
79
—> 80 assert np.allclose(a[5, 2, 2:6], [0.99999291, 0.99332189, 0.9921928, 0.99503445]), “Wrong values for a”
81 assert np.allclose(y_pred[2, 1, 1: 5], [0.19428, 0.14292, 0.24993, 0.00119], atol=1e-4), “Wrong values for y_pred”
82 assert np.allclose(caches[1], x_tmp), f"Fail check: cache[1] != x_tmp"

AssertionError: Wrong values for a

Please click my name and message your notebook as an attachment.

Error is in the inner loop for the forward pass. You’re using a which was initialized to 0s to start with. You should pass 0s only when t = 0. Please fix rnn_cell_forward.

Thanks! After you pointed out the location of the problem, I read through the instruction again and got it right this time.