Skip to content

unaiverse.modules.cnu

Continual Neural Units (CNUs) are neurons whose weights depend on the input. Each unit keeps a set of keys and a memory per key, selects the keys closest to the current input and blends their memories into the weights of that sample. A network with CNU layers learns a new region of the input space mostly by changing the memories of the keys of that region. This limits the interference with what it learned elsewhere when the data arrive as a stream (see Models).

cnu

Importing the package imports its three modules:

Module Content
cnus CNUs, the base class that holds the keys and the memories and computes the blended weights.
layers LinearCNU and Conv2d, the CNU counterparts of torch.nn.Linear and torch.nn.Conv2d.
psi The projections of the input on the key space.

The ready-made processors SingleLayerCNU, CNNCNU, ResNetCNU and the CTE and CTBE networks with cnu_memories > 0 of networks are built on LinearCNU.