Advantage of cache over a dictionary

Why do we prefer storing activation A (and in week 4, also parameters W and b) for re-use in backward propagation in a cache, not in a dictionary?

  1. What makes a cache better than a dictionary for storing?
  2. What is the main technical difference between a cache and a dictionary in terms of storing values?

Are you sure cache isn’t merely used as a descriptive variable name (and not a data type) ?

Note the absence of cache here: 5. Data Structures — Python 3.10.8 documentation

or here: 3. Data model — Python 3.10.8 documentation

Here is the relevant excerpt from the Data model page…

Mappings

These represent finite sets of objects indexed by arbitrary index sets. The subscript notation a[k]selects the item indexed by k from the mapping a; this can be used in expressions and as the target of assignments or del statements. The built-in function len() returns the number of items in a mapping.

There is currently a single intrinsic mapping type:

Dictionaries

These represent finite sets of objects indexed by nearly arbitrary values

my emphasis added

1 Like

Hi @Doron_Modan ,

As @ai_curious says, cache is just the name of the variable, but it is really a dictionary. If you have the chance, check out lab lab from week 3 where you’ll find examples of this.

Juan

1 Like

Right! The word cache is indeed in plain font, no special colour

1 Like