BaseNeuralNet.register_buffer(name, tensor)

Adds a persistent buffer to the module.

This is typically used to register a buffer that should not to be considered a model parameter. For example, BatchNorm’s running_mean is not a parameter, but is part of the persistent state.

Buffers can be accessed as attributes using given names.

name (string): name of the buffer. The buffer can be accessed
from this module using the given name

tensor (Tensor): buffer to be registered.


>>> self.register_buffer('running_mean', torch.zeros(num_features))