As we showcased in the preceding section, an NTM's controller is capable of using content-based addressing, location-based addressing, or both, whereas MANN works by using a pure content-based memory writer.
MANN also uses a new addressing schema called least recently used access. The idea behind this schema is that the least recently used memory location is determined by the read operation and the read operation is performed by content-based addressing. So we basically perform content-based addressing for reading and write to the location that was least recently used.
In this tutorial, we will implement read and write operations.
- Let's first import all the libraries that we need:
import torchfrom torch import nn ...