torch.nn.Module.register_forward_pre_hook
Module.register_forward_pre_hook(hook: ForwardPreHook): RemovableHandleRegister a forward pre-hook on this module. The hook will be called before forward() is invoked.
Parameters
hookForwardPreHook- Function called with (module, input)
Returns
RemovableHandle– Handle to remove the hook