Shortcuts

Buffer

class torch.nn.parameter.Buffer(data=None, *, persistent=True)[source][source]

A kind of Tensor that should not be considered a model parameter. For example, BatchNorm’s running_mean is not a parameter, but is part of the module’s state.

Buffers are Tensor subclasses, that have a very special property when used with Module s – when they’re assigned as Module attributes they are automatically added to the list of its buffers, and will appear e.g. in buffers() iterator. Assigning a Tensor doesn’t have such effect. One can still assign a Tensor as explicitly by using the register_buffer() function.

Parameters
  • data (Tensor) – buffer tensor.

  • persistent (bool, optional) – whether the buffer is part of the module’s state_dict. Default: True

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources