We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Thanks for the nice library. I wanted to try LSMR but my first attempt to use it with a trivial problem failed with NaN output.
Steps to reproduce:
import torch import torchmin A = torch.eye(10) xtrue = torch.zeros((10, 1)) b = A @ xtrue x = torchmin.lstsq.lsmr.lsmr(A,b)[0] print(x)
which resulted in
tensor([nan, nan, nan, nan, nan, nan, nan, nan, nan, nan])
instead of 0s
The text was updated successfully, but these errors were encountered:
Note that the same holds with a slightly less trivial but still trivial case:
import torch import torchmin A = torch.eye(10) xtrue = torch.ones((10, 1)) b = A @ xtrue x = torchmin.lstsq.lsmr.lsmr(A,b)[0] print(x)
Comparing the source code with that of scipy points to the following issues.
normr and normar are initialiased differently and do not include the "convergence" tests at the very beginning
normr
normar
pytorch-minimize/torchmin/lstsq/lsmr.py
Lines 148 to 149 in 1017e97
Within the main iteration loop, the convergence test is only done every 10 iterations
Lines 257 to 259 in 1017e97
Sorry, something went wrong.
For the record, I made a few changes here: https://github.com/cai4cai/torchsparsegradutils/blob/main/torchsparsegradutils/utils/lsmr.py
No branches or pull requests
Thanks for the nice library. I wanted to try LSMR but my first attempt to use it with a trivial problem failed with NaN output.
Steps to reproduce:
which resulted in
instead of 0s
The text was updated successfully, but these errors were encountered: