-
Notifications
You must be signed in to change notification settings - Fork 98
[TorchFix] Add torch.solve as a removed function #4705
New issue
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,3 +48,19 @@ To enable them, use standard flake8 configuration options for the plugin mode or | |
|
||
If you encounter a bug or some other problem with TorchFix, please file an issue on | ||
https://github.com/pytorch/test-infra/issues, mentioning [TorchFix] in the title. | ||
|
||
|
||
## Rules | ||
|
||
### TOR001 Use of removed function | ||
|
||
#### torch.solve | ||
|
||
This function was deprecated since PyTorch version 1.9 and is now removed. | ||
|
||
`torch.solve` is deprecated in favor of `torch.linalg.solve`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems like we still mention There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good find! I'll update that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
`torch.linalg.solve` has its arguments reversed and does not return the LU factorization. | ||
|
||
To get the LU factorization see `torch.lu`, which can be used with `torch.lu_solve` or `torch.lu_unpack`. | ||
|
||
`X = torch.solve(B, A).solution` should be replaced with `X = torch.linalg.solve(A, B)`. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import torch | ||
A = torch.randn(3, 3) | ||
b = torch.randn(3) | ||
torch.solve(A, b).solution |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
4:1 TOR001 Use of removed function torch.solve: https://github.com/pytorch/test-infra/tree/main/tools/torchfix#torchsolve |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a doc/page that calls out this function as deprecated? If so, what do you think of linking to it here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it's removed from the docs.
The YAML in the PR has links to deprecate and remove PRs, I plan later to use these links to generate some docs.