Rate this Page

torch.Tensor.module_load#

Tensor.module_load(other,assign=False)[source]#

Defines how to transformother when loading it intoself inload_state_dict().

Used whenget_swap_module_params_on_conversion() isTrue.

It is expected thatself is a parameter or buffer in annn.Module andother is thevalue in the state dictionary with the corresponding key, this method defineshowother is remapped before being swapped withself viaswap_tensors() inload_state_dict().

Note

This method should always return a new object that is notself orother.For example, the default implementation returnsself.copy_(other).detach()ifassign isFalse orother.detach() ifassign isTrue.

Parameters