Pytorch 0.4.1 getting gradient at a particular node

Have a look at this thread.
register_hook is probably, what you want.