torch.Tensor.module_load#
- Tensor.module_load(other, assign=False)[source]#
Defines how to transform
otherwhen loading it intoselfinload_state_dict().Used when
get_swap_module_params_on_conversion()isTrue.It is expected that
selfis a parameter or buffer in annn.Moduleandotheris the value in the state dictionary with the corresponding key, this method defines howotheris remapped before being swapped withselfviaswap_tensors()inload_state_dict().Note
This method should always return a new object that is not
selforother. For example, the default implementation returnsself.copy_(other).detach()ifassignisFalseorother.detach()ifassignisTrue.- Parameters
other (Tensor) – value in state dict with key corresponding to
selfassign (bool) – the assign argument passed to
nn.Module.load_state_dict()