Module
or a Tensor
. It will be called when a forward
or a backward
call is executed on a Module
or when a gradient is calculated with regards to a Tensor
. In the case of a forward hook, it will be passed the module it is registered on and the input and the output of the operation.