In the following toy example, I register hooks for each variable, but only hook grad for x and w print True and s will print False.
def hk(x):
    print(x.requires_grad)

x = torch.randn(16, 5, requires_grad=True)
x.register_hook(hk)
w = torch.randn(5, 3, requires_grad=True)
w.register_hook(hk)

s = torch.mm(x,w)
s.requires_grad_()
s.retain_grad()
s.register_hook(hk)

y = s.sum()
y.backward(create_graph=True)

I further set s.retain_grad(), but only x.grad and w.grad have grad_fn, and s.grad doesn’t.
It seems that I can only get grad values of intermediate variables rather than further processing them.