Hello,
I am having an issue with c5 w1 assignment 1 exercise 3 (implementing lstm_cell_forward function)
I got all shapes right but I am getting the values for all variables a_next, c_next, and yt that are different from the expected output. I am not sure what is causing the problem. Please suggest me anything to fix it. Here is the error I am getting:
Also in the given codes, there are variables named n_x, m, n_y, and n_a which are retrieved from shapes of xt and Wy but I am not using them directly. So I am wondering if they are supposed to be used. I used xt and Wy but I don’t see where I would need n_x, m, n_y, and n_a; please let me know!
Thank you.
Hello @Sujung_Choi,
Let’s tackle the problem head to head
As always, the error message first. It said “wrong values for ft”, and it said so because it was checking for values in the 4th element of cache
:
So, your function didn’t calculate ft
correctly. Even though you need to implement many lines for that function, there are just two lines relevant to ft
! Therefore, to debug that error, you only need to focus on two lines. Recall how ft
is calculated:
It gets Wf, bf, a^{<t-1>} and x^{<t>} involved, so these are the variables you need to use in those two lines. In particular,
we need to concatenate a^{<t-1>} and x^{<t>} first because it is going to be reused many times.
So, the first line is about concatenating two variables, whereas the second line is to compute ft with the formula above.
For your reference, I have added two print lines in my notebook and I am sharing the printed results for you to cross-check:
We are implementing the formulae, and if they don’t use them, we don’t use them.
Good luck!
Raymond