It’s expected that no gradients will be available in the hook, if you disable the gradient calculation.
register_backward_hook is also deprecated in favor of register_full_backward_hook 1, so you might want to change the usage.