Implementation of MAAN

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.

  1. Let's first import all the libraries that we need:
import torchfrom torch import nn ...

Get Hands-On One-shot Learning with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.