Improve error message for non-differentiable inputs (#60610)
Summary:
Improve the error message when inputs should not requires_grad=True.
For example, we now get
```
RuntimeError: The function 'binary_cross_entropy' is not differentiable with respect to argument 'weight'. This input cannot have requires_grad True.
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/60610
Reviewed By: anjali411
Differential Revision: D29361424
Pulled By: albanD
fbshipit-source-id: 38163ce11ae1b8df326424e95ca20e55fea2a99a