Fix lstsq to work with inputs that require grad (#66426)
Summary:
I updated `sample_inputs_linalg_lstsq` and `test_nondifferentiable`
now correctly reveals the failure. The internal assert error was thrown
because autograd attempts to mark integer tensor as differentiable.
Fixes https://github.com/pytorch/pytorch/issues/66420.
cc ezyang albanD zou3519 gqchen pearu nikitaved soulitzer Lezcano Varal7
Pull Request resolved: https://github.com/pytorch/pytorch/pull/66426
Reviewed By: ejguan
Differential Revision: D31550942
Pulled By: albanD
fbshipit-source-id: 4a0ca60e62c5e9bb96af5020541da2d09ea3e405