Torch.lstsq output size incorrect

I have a A, 10-by-6 source tensor, and a b, 10-by-1 destination tensor.
I want to solve for x such that Ax = b. x should be a 6-by-1 tensor (or a 1-by-6 since documentation says the transform is returned)

import torch

A = torch.ones((10,6))
b = torch.ones((10,1))
M, _ = torch.lstsq(b, A)
print(M.shape)

output: torch.Size([10, 1])

What’s the problem here and how do I get my proper 6-by-1 tensor output??

answered here: torch.lstsq returns wrong tensor size · Issue #56833 · pytorch/pytorch · GitHub