The solution that I obtain from torch.linalg.lstsq(A, B)
is different from what I obtain using numpy.linalg.lstsq(A, B)
. More importantly, the value of the objective function for the former solution is significantly larger than the latter.
Moreover, in numpy I obtain the same solution using numpy.linalg.lstsq(A, B)
and numpy.linalg.pinv(A) @ B
. The solution obtained by torch.pinverse(A) @ B
is closer to the numpy solution, but also different from the one obtained by torch.linalg.lstsq(A, B)
.
Does this mean that torch.linalg.lstsq()
is providing wrong solutions?
This gist contains the data and scripts that demonstrate this inconcictency.