# loop over all time-steps

```
for t in range(T_x):
# Update next hidden state, compute the prediction, get the cache (≈1 line)
a_next, yt_pred, cache = rnn_cell_forward(x[:,:,t], a_next, parameters_tmp)
# Save the value of the new "next" hidden state in a (≈1 line)
a[:,:,t] = a_next
# Save the value of the prediction in y (≈1 line)
y_pred[:,:,t] = yt_pred
# Append "cache" to "caches" (≈1 line)
caches.append(cache)
### END CODE HERE ###
```

Please advise on this part, as it is produces the following error:

~/work/W1A1/public_tests.py in rnn_forward_test(target)

69 parameters_tmp[‘by’] = np.random.randn(n_y, 1)

70

—> 71 a, y_pred, caches = target(x_tmp, a0_tmp, parameters_tmp)

72

73 assert a.shape == (n_a, m, T_x), f"Wrong shape for a. Expected: ({n_a, m, T_x}) != {a.shape}"

in rnn_forward(x, a0, parameters)

41 for t in range(T_x):

42 # Update next hidden state, compute the prediction, get the cache (≈1 line)

—> 43 a_next, yt_pred, cache = rnn_cell_forward(x[:,:,t], a_next, parameters_tmp)

44 # Save the value of the new “next” hidden state in a (≈1 line)

45 a[:,:,t] = a_next

in rnn_cell_forward(xt, a_prev, parameters)

30 ### START CODE HERE ### (≈2 lines)

31 # compute next activation state using the formula given above

—> 32 a_next = np.tanh(np.dot(Wax,xt) + np.dot(Waa,a_prev) + ba)

33 # compute output of the current cell using the formula given above

34 yt_pred = softmax(np.dot(Wya,a_next) + by)

<**array_function** internals> in dot(*args, **kwargs)

ValueError: shapes (5,3) and (4,8) not aligned: 3 (dim 1) != 4 (dim 0)