In first assignment of week 1:
Building_a_Recurrent_Neural_Network_Step_by_Step
2.1 - LSTM Cell
Exercise 3 - lstm_cell_forward
I got this incorrect output with the following error:
a_next[4] =
[-7.56580584e-01 2.73639696e-04 3.97312015e-03 2.85080466e-02
-6.61200072e-01 3.44729752e-02 3.69971680e-01 1.93165051e-01
-4.40045843e-01 4.04481552e-01]
a_next.shape = (5, 10)
c_next[2] =
[ 0.63267805 1.00570849 0.35504474 0.20690913 -1.64566718 0.11832942
0.76449811 -0.0981561 -0.74348425 -0.26810932]
c_next.shape = (5, 10)
yt[1] = [0.91722549 0.14309228 0.2110208 0.24617349 0.96254818 0.28948215
0.07747774 0.20988141 0.81554248 0.16894127]
yt.shape = (2, 10)
cache[1][3] =
[-0.16263996 1.03729328 0.72938082 -0.54101719 0.02752074 -0.30821874
0.07651101 -1.03752894 1.41219977 -0.37647422]
len(cache) = 10
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
<ipython-input-170-7dee818208b9> in <module>
27
28 # UNIT TEST
---> 29 lstm_cell_forward_test(lstm_cell_forward)
~/work/W1A1/public_tests.py in lstm_cell_forward_test(target)
126 assert np.allclose(cache[1][0, 0:2], [0.1352798, 0.39884899]), "wrong values for c_next"
127 assert np.allclose(cache[7][0, 0:2], [0.7477249, 0.71588751]), "wrong values for ot"
--> 128 assert np.allclose(cache[0][0, 0:2], [0.10053951, 0.27129536]), "wrong values for a_next"
129
130 assert np.allclose(y_pred[1], [0.417098, 0.449528, 0.223159, 0.278376,
AssertionError: wrong values for a_next
Here’s my attempt:
{moderator edit - solution code removed}
Any advice please?