8000 Remove deprecated torch.cholesky by IvanYashchuk · Pull Request #70979 · pytorch/pytorch · GitHub
[go: up one dir, main page]

Skip to content

Remove deprecated torch.cholesky #70979

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

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
1d6b073
Remove deprecated torch.cholesky
IvanYashchuk Jan 7, 2022
4dc3fe1
Merge remote-tracking branch 'upstream/master' into remove-cholesky
IvanYashchuk Mar 11, 2022
df7ff65
Remove aten_interned_strings.h
IvanYashchuk Mar 11, 2022
615fd55
Merge remote-tracking branch 'upstream/master' into remove-cholesky
IvanYashchuk Feb 28, 2023
e9f72ce
Remove cholesky batching rule
IvanYashchuk Feb 28, 2023
967a8a1
Add RuntimeError when calling cholesky
IvanYashchuk Feb 28, 2023
5025b4a
Remove more cholesky mentiones in tests
IvanYashchuk Mar 1, 2023
a79855a
Merge remote-tracking branch 'upstream/viable/strict' into remove-cho…
IvanYashchuk Mar 1, 2023
aebf439
Remove unused import
IvanYashchuk Mar 6, 2023
99eebba
Formatting
IvanYashchuk Mar 6, 2023
ef38d8c
Remove cholesky opinfo mentions
IvanYashchuk Mar 6, 2023
8bfca94
Remove cholesky opinfo mentions
IvanYashchuk Mar 6, 2023
7395938
Remove cholesky opinfo mentions
IvanYashchuk Mar 7, 2023
bb9dba6
Remove cholesky opinfo mentions
IvanYashchuk Mar 7, 2023
ed66ff3
Remove cholesky opinfo mentions
IvanYashchuk Mar 7, 2023
1e60c87
Remove cholesky opinfo mentions
IvanYashchuk Mar 7, 2023
8610212
Add cholesky to overrides ignore list
IvanYashchuk Mar 9, 2023
f0c7eb6
Merge remote-tracking branch 'upstream/viable/strict' into remove-cho…
IvanYashchuk Mar 9, 2023
a9629f2
Merge remote-tracking branch 'upstream/viable/strict' into remove-cho…
IvanYashchuk Apr 5, 2023
5096611
Update xla pin
IvanYashchuk Apr 5, 2023
8a2a3e3
Update xla pin
IvanYashchuk Apr 5, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add RuntimeError when calling cholesky
  • Loading branch information
IvanYashchuk committed Feb 28, 2023
commit 967a8a11321c799fc20b94441192fc974a1dfa13
7 changes: 7 additions & 0 deletions test/test_linalg.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,13 @@ def run_test_case(a, b):
run_test_case(zero_strided, b)
run_test_case(a, zero_strided)

def test_cholesky_removed_error(self, device):
a = make_tensor(5, 5, device=device, dtype=torch.float32)
with self.assertRaisesRegex(RuntimeError, "This function was deprecated since version 1.9 and is now removed"):
torch.cholesky(a)
with self.assertRaisesRegex(RuntimeError, "This function was deprecated since version 1.9 and is now removed"):
a.cholesky()

def test_matrix_rank_removed_error(self, device):
a = make_tensor(5, 5, device=device, dtype=torch.float32)
with self.assertRaisesRegex(RuntimeError, "This function was deprecated since version 1.9 and is now removed"):
Expand Down
1 change: 1 addition & 0 deletions torch/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1319,6 +1319,7 @@ def compiled_with_cxx11_abi():

# Import removed ops with error message about removal
from ._linalg_utils import ( # type: ignore[misc]
cholesky,
matrix_rank,
eig,
solve,
Expand Down
5 changes: 5 additions & 0 deletions torch/_linalg_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ def symeig(A: Tensor, largest: Optional[bool] = False) -> Tuple[Tensor, Tensor]:

# These functions were deprecated and removed
# This nice error message can be removed in version 1.13+
def cholesky(input: Tensor, upper: bool = False, *, out=None) -> Tensor:
raise RuntimeError(
"This function was deprecated since version 1.9 and is now removed. Please use the `torch.linalg.cholesky` function instead.",
)

def matrix_rank(input, tol=None, symmetric=False, *, out=None) -> Tensor:
raise RuntimeError(
"This function was deprecated since version 1.9 and is now removed.",
Expand Down
5 changes: 5 additions & 0 deletions torch/_tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,11 @@ def norm(
)
return torch.norm(self, p, dim, keepdim, dtype=dtype)

def cholesky(self, upper=False):
from ._linalg_utils import cholesky

return cholesky(self, upper=upper)

def solve(self, other):
from ._linalg_utils import solve

Expand Down
0