Week1 - 1st assignment - lstm_forward function

Hi everyone,

I am having an issue with the lstm_forward fonction.
The last step is to “Append the cache into caches (≈1 line)” and I believe my problem is my Python knwoledge. I tried to look at this : numpy append function

But, this is not leading me anywhere.
The aim is to append cache into caches, so I did : np.append(caches, cache), but I still got the error : AssertionError: Wrong shape for caches. 0 != 16

Can someone lead me to the correct answer ?


Hi @Edouard,

Python has a set of build-in methods to be used with list or array, and append() is one of them.

In this instance, the variable caches is declared as an empty array. To attach another cache to caches, we do the following:


Here is a link to some python resources that you may find useful.

Thank you very much Kic. That is helpful.