Skip to content
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

Update parametrizations.py #2642

Merged
merged 2 commits into from
Nov 4, 2023
Merged

Update parametrizations.py #2642

merged 2 commits into from
Nov 4, 2023

Conversation

ahoblitz
Copy link
Contributor

@ahoblitz ahoblitz commented Nov 3, 2023

For PyTorch 2, torch.solve => torch.linalg.solve

Fixes #2641

Description

Code like
def forward(self, X):
# (I + X)(I - X)^{-1}
return torch.solve(self.Id + X, self.Id - X).solution
results in
RuntimeError: This function was deprecated since version 1.9 and is now removed. torch.solve is deprecated in favor of torch.linalg.solve. torch.linalg.solve has its arguments reversed and does not return the LU factorization.

Update to use pytorch.linalg.solve

Checklist

  • The issue that is being fixed is referred in the description (see above "Fixes #ISSUE_NUMBER")
  • Only one issue is addressed in this pull request
  • Labels from the issue that this PR is fixing are added to this pull request
  • No unnecessary issues are included into this pull request.

cc @albanD @sekyondaMeta @svekars @carljparker @NicolasHug @kit1980 @subramen

For PyTorch 2, torch.solve => torch.linalg.solve
Copy link

pytorch-bot bot commented Nov 3, 2023

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/tutorials/2642

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit 61ccafe with merge base 3ac15b1 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@svekars svekars added the core Tutorials of any level of difficulty related to the core pytorch functionality label Nov 3, 2023
@svekars svekars self-requested a review November 3, 2023 22:53
@svekars svekars requested a review from albanD November 3, 2023 22:54
Copy link
Contributor

@svekars svekars left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for catching this.

Copy link
Contributor

@malfet malfet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As warning correctly mentions, you need to change argument order

intermediate_source/parametrizations.py Outdated Show resolved Hide resolved
intermediate_source/parametrizations.py Outdated Show resolved Hide resolved
Co-authored-by: Svetlana Karslioglu <svekars@meta.com>
@svekars svekars requested a review from malfet November 3, 2023 23:38
@malfet malfet merged commit e7563f6 into pytorch:main Nov 4, 2023
20 checks passed
malfet pushed a commit to pytorch/test-infra that referenced this pull request Nov 9, 2023
Add torch.solve as a removed function (I somehow missed it before and
noticed after pytorch/tutorials#2642).

Also added a mechanism to show reference links in the error messages.
kit1980 added a commit to pytorch-labs/torchfix that referenced this pull request Nov 23, 2023
Add torch.solve as a removed function (I somehow missed it before and
noticed after pytorch/tutorials#2642).

Also added a mechanism to show reference links in the error messages.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla signed core Tutorials of any level of difficulty related to the core pytorch functionality docathon-h2-2023 medium
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] - Parametrizations Tutorial should be updated to use pytorch.linalg.solve
4 participants