Cache concept problem - course 5- week 1

Hello.
I have a problem in understanding the cache concept. How can you specify in each “def” what values (or other appropriate parameters) can be assigned to the cache?

for example in def rnn_cell_forward(xt, a_prev, parameters):

cache – tuple of values needed for the backward pass, contains (a_next, a_prev, xt, parameters)

and in def rnn_forward(x, a0, parameters):

caches – tuple of values needed for the backward pass, contains (list of caches, x)

@simamh
cache ( it means ‘hide’ in French) can be anything you want to keep and pass on.
cache is a variable name we often use to save some values that will be useful in some other functions. For example, you saw that it was used to store the previous activity values from the prior layers in a simple Neural Net architecture.
What you store in cache is just up to you and what you need (or make it easy) in order to compute some other value you need.

1 Like