Deprecate torch.cholesky (#57725)

Summary:
**BC-breaking note:**

This PR deprecates torch.cholesky in favor of torch.linalg.cholesky. A upgrade guide is added to the documentation for torch.cholesky.

Note this PR DOES NOT remove torch.cholesky.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/57725

Reviewed By: bdhirsh

Differential Revision: D28318260

Pulled By: mruberry

fbshipit-source-id: e7ba049321810e70f4de08e6ac37ff800e576152
This commit is contained in:
lezcano
2021-05-10 22:43:13 -07:00
committed by Facebook GitHub Bot
parent f3e014f37b
commit 4fef1c1d74
6 changed files with 50 additions and 14 deletions

View File

@ -228,7 +228,7 @@ def _symeig_backward_partial_eigenspace(D_grad, U_grad, A, D, U, largest):
#
# check if `chr_poly_D_at_A_to_U_ortho` is positive-definite or negative-definite
chr_poly_D_at_A_to_U_ortho_sign = -1 if (largest and (k % 2 == 1)) else +1
chr_poly_D_at_A_to_U_ortho_L = torch.cholesky(
chr_poly_D_at_A_to_U_ortho_L = torch.linalg.cholesky(
chr_poly_D_at_A_to_U_ortho_sign * chr_poly_D_at_A_to_U_ortho
)
@ -939,7 +939,8 @@ class LOBPCG(object):
SBS = _utils.qform(B, S)
d_row = SBS.diagonal(0, -2, -1) ** -0.5
d_col = d_row.reshape(d_row.shape[0], 1)
R = torch.cholesky((SBS * d_row) * d_col, upper=True)
# TODO: Consider reordering the operations to work with lower-triangular matrices
R = torch.linalg.cholesky(((SBS * d_row) * d_col).transpose(-2, -1).conj()).transpose(-2, -1).conj()
# TODO: could use LAPACK ?trtri as R is upper-triangular
Rinv = torch.inverse(R)
return Rinv * d_col