nnrl/optim/kfac.py
def register_hooks(self) -> tuple[list, list]:
        """Adds hooks to the monitored module for storing inputs and grads."""
        fwd_handles, bwd_handles = [], []
        for mod in self._hookable_modules:
            fwd_handles += [mod.register_forward_pre_hook(self.save_input)]
            bwd_handles += [mod.register_full_backward_hook(self.save_grad_out)]
        return fwd_handles, bwd_handles
Adds hooks to the monitored module for storing inputs and grads.
Adds hooks to the monitored module for storing inputs and grads.
Adds hooks to the monitored module for storing inputs and grads .
def register_hooks(self) -> tuple[list, list]:
        fwd_handles, bwd_handles = [], []
        for mod in self._hookable_modules:
            fwd_handles += [mod.register_forward_pre_hook(self.save_input)]
            bwd_handles += [mod.register_full_backward_hook(self.save_grad_out)]
        return fwd_handles, bwd_handles
def register_hooks ( self ) -> tuple [ list , list ] : fwd_handles , bwd_handles = [ ] , [ ] for mod in self . _hookable_modules : fwd_handles += [ mod . register_forward_pre_hook ( self . save_input ) ] bwd_handles += [ mod . register_full_backward_hook ( self . save_grad_out ) ] return fwd_handles , bwd_handles
Adds hooks to the monitored module for storing inputs and grads.
Adds hooks to the monitored module for storing inputs and grads .
"""Adds hooks to the monitored module for storing inputs and grads."""
self