I am trying to implement D5W1 A1 Assignment Exercise 7 " LSTM Backward Pass" but got stuck in understanding this part in parameter derivates
Parameter Derivatives
πππ=ππΎβ¨π‘β©π[πππππ£π₯π‘]π(11)(11)dWf=dΞ³fβ¨tβ©[aprevxt]Tπππ’=ππΎβ¨π‘β©π’[πππππ£π₯π‘]π(12)(12)dWu=dΞ³uβ¨tβ©[aprevxt]Tπππ=πππΛβ¨π‘β©[πππππ£π₯π‘]π(13)(13)dWc=dpc~β¨tβ©[aprevxt]Tπππ=ππΎβ¨π‘β©π[πππππ£π₯π‘]π(14)
The instruction here appear to ask us to concatenate the matrix a_prev with xt. but they are of different size and once I done that the following numpy error appears.
TypeError Traceback (most recent call last)
in
19 da_next_tmp = np.random.randn(5,10)
20 dc_next_tmp = np.random.randn(5,10)
β> 21 gradients_tmp = lstm_cell_backward(da_next_tmp, dc_next_tmp, cache_tmp)
22 print(βgradients["dxt"][1][2] =β, gradients_tmp[βdxtβ][1][2])
23 print(βgradients["dxt"].shape =β, gradients_tmp[βdxtβ].shape)
in lstm_cell_backward(da_next, dc_next, cache)
46 print (a_prev.shape)
47 print (xt.shape)
β> 48 concat = np.concatenate(a_prev, xt)
49 print (concat.shape)
50 dWf = np.dot(dft, (np.concatenate(a_prev, xt)).T)
<array_function internals> in concatenate(*args, **kwargs)
TypeError: only integer scalar arrays can be converted to a scalar index
For debugging purpose the shape of a_prev and xt are:
(5, 10)
(3, 10)
My lab ID is pahlbtkn