register_load_state_dict_post_hook
- UNet.register_load_state_dict_post_hook(hook)
- Registers a post hook to be run after module’s - load_state_dictis called.- It should have the following signature::
- hook(module, incompatible_keys) -> None 
 - The - moduleargument is the current module that this hook is registered on, and the- incompatible_keysargument is a- NamedTupleconsisting of attributes- missing_keysand- unexpected_keys.- missing_keysis a- listof- strcontaining the missing keys and- unexpected_keysis a- listof- strcontaining the unexpected keys.- The given incompatible_keys can be modified inplace if needed. - Note that the checks performed when calling - load_state_dict()with- strict=Trueare affected by modifications the hook makes to- missing_keysor- unexpected_keys, as expected. Additions to either set of keys will result in an error being thrown when- strict=True, and clearing out both missing and unexpected keys will avoid an error.- Returns:
- a handle that can be used to remove the added hook by calling - handle.remove()
- Return type:
- torch.utils.hooks.RemovableHandle