Undestanding register_*_hook() functions

Could anyone explain what these methods do? And in which situation should I use them?. I looked at the documentation but it only says Registers a * hook on the module and it’s not clear to me what that means. Thanks in advance!

Have a look at this tutorial.
Basically the hooks can be used used to manipulate or get the intermediate activations and gradients.
You can find a simple example of using forward hooks here.


Thanks for your reply. I will check them out

1 Like