Using hook function to save gradients

Update:
So I found this answer Explicitly obtain gradients? today. What’s the difference between using register_backward_hook() and grad = [p.grad for p in list(network.parameters())]?