W3cubDocs

/PyTorch 2.9

torch.nn.utils.parametrize.transfer_parametrizations_and_params

torch.nn.utils.parametrize.transfer_parametrizations_and_params(from_module, to_module, tensor_name=None) [source]

Transfer parametrizations and the parameters they parametrize from from_module to to_module.

If tensor_name is specified, only transfers the specified parameter, otherwise transfers all parametrized parameters. If those parameters do not exist in to_module, it will create them. Does nothing if from_module is not parametrized.

Parameters
  • from_module (nn.Module) – module to transfer from
  • to_module (nn.Module) – module to transfer to
  • tensor_name (str, optional) – parameter to transfer
Returns

to_module

Return type

Module

© 2025, PyTorch Contributors
PyTorch has a BSD-style license, as found in the LICENSE file.
https://docs.pytorch.org/docs/2.9/generated/torch.nn.utils.parametrize.transfer_parametrizations_and_params.html