ParametrizationList¶
- class torch.nn.utils.parametrize.ParametrizationList(modules, original, unsafe=False)[source]¶
A sequential container that holds and manages the
originalororiginal0,original1, … parameters or buffers of a parametrizedtorch.nn.Module.It is the type of
module.parametrizations[tensor_name]whenmodule[tensor_name]has been parametrized withregister_parametrization().If the first registered parmetrization has a
right_inversethat returns one tensor or does not have aright_inverse(in which case we assume thatright_inverseis the identity), it will hold the tensor under the nameoriginal. If it has aright_inversethat returns more than one tensor, these will be registered asoriginal0,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]¶
Calls the methods
right_inverse(seeregister_parametrization()) of the parametrizations in the inverse order they were registered in. Then, it stores the result inself.originalifright_inverseoutputs one tensor or inself.original0,self.original1, … if it outputs several.- Parameters:
value (Tensor) – Value to which initialize the module