Fixes: register_full_backward_hook crash if first argument don't require a gradient (#57944) (#57945)
Summary:
Fixes https://github.com/pytorch/pytorch/issues/57944
Pull Request resolved: https://github.com/pytorch/pytorch/pull/57945
Reviewed By: mruberry
Differential Revision: D28351929
Pulled By: albanD
fbshipit-source-id: d0db898e6bf13d1877cd81892a5a65c7854c8102