Migrate `torch.lstsq` to ATen (#59400)
Summary:
Closes https://github.com/pytorch/pytorch/issues/24726, closes https://github.com/pytorch/pytorch/issues/44011
This builds on the port from https://github.com/pytorch/pytorch/issues/44011. I've rebased on master and addressed mruberry's comments. There were also some unnecessary copies of `B` taking place that I've cleaned up. This function is already deprecated, but since it's the last lapack routine in TH, it's still worth porting.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/59400
Reviewed By: mruberry
Differential Revision: D28922060
Pulled By: ngimel
fbshipit-source-id: cfd7ec8b50d2ab886f0e04a2a557e4e410ee8184