Rate this Page
โ˜… โ˜… โ˜… โ˜… โ˜…

ParametrizationList#

class torch.nn.utils.parametrize.ParametrizationList(modules, original, unsafe=False)[source]#

A sequential container that holds and manages the original parameters or buffers of a parametrized torch.nn.Module.

It is the type of module.parametrizations[tensor_name] when module[tensor_name] has been parametrized with register_parametrization().

If the first registered parametrization has a right_inverse that returns one tensor or does not have a right_inverse (in which case we assume that right_inverse is the identity), it will hold the tensor under the name original. If it has a right_inverse that returns more than one tensor, these will be registered as original0, original1, โ€ฆ

Warning

This class is used internally by register_parametrization(). It is documented here for completeness. It shall not be instantiated by the user.

Parameters
  • modules (sequence) โ€“ sequence of modules representing the parametrizations

  • original (Parameter or Tensor) โ€“ parameter or buffer that is parametrized

  • unsafe (bool) โ€“ a boolean flag that denotes whether the parametrization may change the dtype and shape of the tensor. Default: False Warning: the parametrization is not checked for consistency upon registration. Enable this flag at your own risk.

right_inverse(value)[source]#

Call the right_inverse methods of the parametrizations in the inverse registration order.

Then, it stores the result in self.original if right_inverse outputs one tensor or in self.original0, self.original1, โ€ฆ if it outputs several.

Parameters

value (Tensor) โ€“ Value to which initialize the module