评价此页

torch.nn.modules.module.register_module_full_backward_pre_hook#

torch.nn.modules.module.register_module_full_backward_pre_hook(hook)[source]#

Register a backward pre-hook common to all the modules.

警告

This adds global state to the nn.module module and it is only intended for debugging/profiling purposes.

Hooks registered using this function behave in the same way as those registered by torch.nn.Module.register_full_backward_pre_hook(). Refer to its documentation for more details.

Hooks registered using this function will be called before hooks registered using torch.nn.Module.register_full_backward_pre_hook().

返回

一个句柄,可用于通过调用 handle.remove() 来移除添加的钩子

返回类型

torch.utils.hooks.RemovableHandle