Hi,
First i would advise you not to use hooks on nn.Modules but add them to Tensors: s.register_hook(your_fn). In particular, as you can see in the doc, register_backward_hook is discouraged.
Now in your hook. The gradient will require gradients only if you backardprop with create_graph=True.