Exercise 4 - lstm_forward Error: 'Wrong values for a'

Hello!

While working on “Exercise 4 - lstm_forward” for the “Building your Recurrent Neural Network - Step by Step” lab assignment, I encounter the following error:

What could be the reason?

Thanks in advance!

It is possible that this line:

initialize “a”, “c” and “y” with zeros

or the previous lines of the code where you find the shapes:

Retrieve dimensions from shapes of x and parameters[‘Wy’]

are not implemented right!

1 Like

I have applied recommended function np.zeros() to initialize ‘a’, ‘c’ and ‘y’ with zeros, and have retrieved shapes of x and parameters[‘Wy’] with .shape.

Did you also correctly initialize a_next before the loop? Note that is not zeros.

Also I assume that your lstm_cell_forward function already passes its tests.

2 Likes

Yes, my mistake was that I initialized ‘a_next’ as zeros before the loop.

Thanks!

3 Likes