AttributeError: module 'torch.linalg' has no attribute 'cholesky'

Running the example from the pytorch website gives me this error. see: torch.linalg.cholesky — PyTorch 1.9.0 documentation

I’ve checked that all packages are updated.

!pip install torch -U --user
import torch

a = torch.randn(2, 2, dtype=torch.complex128)
a = a @ a.t().conj() + torch.eye(2) # creates a Hermitian positive-definite matrix
l = torch.linalg.cholesky(a)
a
l
l @ l.t().conj()


AttributeError Traceback (most recent call last)
in
1 a = torch.randn(2, 2, dtype=torch.complex128)
2 a = a @ a.t().conj() + torch.eye(2) # creates a Hermitian positive-definite matrix
----> 3 l = torch.linalg.cholesky(a)
4 a
5 l

AttributeError: module ‘torch.linalg’ has no attribute ‘cholesky’

I cannot reproduce the issue. Could you check the installed PyTorch version via torch.__version__, please?