Undestanding register_*_hook() functions

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.

2 Likes