Table of Contents
Shortcuts

# torch.nn.utils.parametrize.remove_parametrizations

torch.nn.utils.parametrize.remove_parametrizations(module, tensor_name, leave_parametrized=True)

  Removes the parametrizations on a tensor in a module.

  - If `leave_parametrized=True`, `module[tensor_name]` will be set to its current output. In this case, the parametrization shall not change the `dtype` of the tensor.

  - If `leave_parametrized=False`, `module[tensor_name]` will be set to the unparametrised tensor in `module.parametrizations[tensor_name].original`. This is only possible when the parametrization depends on just one tensor.

  Parameters:

    - module (nn.Module) – module from which remove the parametrization

    - tensor_name (str) – name of the parametrization to be removed

    - leave_parametrized (bool, optional) – leave the attribute `tensor_name` parametrized. Default: `True`

  Returns:

    module

  Return type:

    Module

  Raises:

    - ValueError – if `module[tensor_name]` is not parametrized

    - ValueError – if `leave_parametrized=False` and the parametrization depends on several tensors

## 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

To analyze traffic and optimize your experience, we serve cookies on this site. By clicking or navigating, you agree to allow our usage of cookies. As the current maintainers of this site, Facebook’s Cookies Policy applies. Learn more, including about available controls: Cookies Policy.