If self.gradients is None, this is most likely because the hook was never called because it wasn’t registered.
For debugging purposes, you can add some prints when the register_hook is called for you to check that it happens for all the modules that you want.