trunk/94705d5841150618c9de1468727580412bc592f8: [MPS] Fix linalg.lstsq on empty inputs (#199694)
- PyTorch: 1880 events in the last 90 days
- PyTorch: 1856th Release in the last 90 days
- Previous: earlier the same day · trunk/8161f9858a7c86698d59776ff0c75930f3423d1f: Move CI docker images off Python 3.10 (#199535)
What happened
On MPS, torch.linalg.lstsq raised IndexError: max(): Expected reduction dim 0 to have non-zero size whenever min(m, n) == 0 . Root cause: the MPS kernel solves the system through an SVD and computes the rank cutoff from the largest singular value, S.max(-1) . An empty matrix has no singular values, and max over an empty dimension has no identity value, so it raises (the same as on CPU). Fix: when min(m, n) == 0 , re…
Summary assembled by rule from the sources below