C5_W1_E2: Persistent Caches error


I am encountering an issue with initializing caches for this exercise:
AssertionError: len(cache) must be T_x = 13
is the persistent error that I am receiving.

I initialized the cache as a list with parameters and x as the inputs using caches = [parameters, x]. I understand because x is appended to the list of caches, len(cache) is expected to be T_x=13. However, I persist in receiving the above error, and I cannot deduce the source of the error. Would anyone have any pointers?

Meanwhile, I noticed that my resulting array for a and y_pred do not align with the expected results of this exercise. However, I am unsure whether this is related to caches.

I appreciate any help you can provide.

Any time you change anything in the Course 5 notebooks, you really should restart the kernel and run all of the cells again.

This is because the Sequence models tend to use a global object for the LSTM, and it needs to be re-built every time you change anything in the model.

So check if you’re been doing that, and reply again if you still have issues.

In rnn_forward, I initialized caches as an empty list. It starts empty and then the instructions describe what gets appended to it in each timestep.

Please show us the error you are seeing about that. Note that in my rnn_forward code, the caches are purely output values. There is no point in the code where I actually use any of the cache values for anything other than to save it in caches for back propagation later.