I have a problem with shape of x in this function. I do not understand why the shape is incorrect.
The function describes x a having this shape:
x – Input data for every time-step, of shape (n_x, m, T_x)
Then I retrieved the dimensions as such:
Retrieve dimensions from shapes of x and parameters[‘Wy’] (≈2 lines)
n_x, m, T_x = x.shape
And I get this error:
ValueError Traceback (most recent call last)
<ipython-input-89-5b9326f2c416> in <module>
14 parameters_tmp['by'] = np.random.randn(2, 1)
15
---> 16 a_tmp, y_tmp, c_tmp, caches_tmp = lstm_forward(x_tmp, a0_tmp, parameters_tmp)
17 print("a[4][3][6] = ", a_tmp[4][3][6])
18 print("a.shape = ", a_tmp.shape)
<ipython-input-88-4979097eb753> in lstm_forward(x, a0, parameters)
51 xt = x[:,:,t]
52 # Update next hidden state, next memory state, compute the prediction, get the cache (≈1 line)
---> 53 a_next, c_next, yt, cache = rnn_forward(xt,a_next,parameters)
54 # Save the value of the new "next" hidden state in a (≈1 line)
55 a[:,:,t] = a_next
<ipython-input-84-952eeea79dce> in rnn_forward(x, a0, parameters)
26
27 # Retrieve dimensions from shapes of x and parameters["Wya"]
---> 28 n_x, m, T_x = x.shape
29 n_y, n_a = parameters["Wya"].shape
30
ValueError: not enough values to unpack (expected 3, got 2)
Why x.shape is only getting 2 dimensions as output ??