torch.nn.modules.module.register_module_full_backward_hook
torch.nn.modules.module.register_module_full_backward_hook(hook)
Registers a backward hook common to all the modules.
Warning:
 This adds global state to the *nn.module* module and it is only
 intended for debugging/profiling purposes.

The hook will be called every time the gradients with respect to a
   module are computed, i.e. the hook will execute if and only if the
   gradients with respect to module outputs are computed. The hook
   should have the following signature:
  hook(module, grad_input, grad_output) -> Tensor or None

The "grad_input" and "grad_output" are tuples. The hook should not
   modify its arguments, but it can optionally return a new gradient
   with respect to the input that will be used in place of
   "grad_input" in subsequent computations. "grad_input" will only
   correspond to the inputs given as positional arguments and all