register_hook will always be called.
It won’t only in two cases:

It was registered on a Tensor for which the gradients was never computed.
The register_hook function is some part of your code that did not run during the forward.