diff --git a/torch/_torch_docs.py b/torch/_torch_docs.py index f652ec317cb8..5228a0b9794a 100644 --- a/torch/_torch_docs.py +++ b/torch/_torch_docs.py @@ -2223,7 +2223,7 @@ def merge_dicts(*dicts): tensor([[ 2.4112, -0.7486, 1.4551], [-0.7486, 1.3544, 0.1294], [ 1.4551, 0.1294, 1.6724]]) - >>> a = torch.randn(3, 2, 2) + >>> a = torch.randn(3, 2, 2) # Example for batched input >>> a = a @ a.mT + 1e-03 # make symmetric positive-definite >>> l = torch.cholesky(a) >>> z = l @ l.mT @@ -2272,7 +2272,7 @@ def merge_dicts(*dicts): >>> a = torch.randn(3, 3) >>> a = torch.mm(a, a.t()) # make symmetric positive definite - >>> u = torch.cholesky(a) + >>> u = torch.linalg.cholesky(a) >>> a tensor([[ 0.7747, -1.9549, 1.3086], [-1.9549, 6.7546, -5.4114], @@ -2311,10 +2311,15 @@ def merge_dicts(*dicts): .. math:: inv = (u^T u)^{{-1}} +Supports input of float, double, cfloat and cdouble dtypes. +Also supports batches of matrices, and if :math:`A` is a batch of matrices then the output has the same batch dimensions. + Args: - input (Tensor): the input 2-D tensor :math:`u`, a upper or lower triangular - Cholesky factor - upper (bool, optional): whether to return a lower (default) or upper triangular matrix + input (Tensor): the input tensor :math:`A` of size :math:`(*, n, n)`, + consisting of symmetric positive-definite matrices + where :math:`*` is zero or more batch dimensions. + upper (bool, optional): flag that indicates whether to return a + upper or lower triangular matrix. Default: False Keyword args: out (Tensor, optional): the output tensor for `inv` @@ -2323,7 +2328,7 @@ def merge_dicts(*dicts): >>> a = torch.randn(3, 3) >>> a = torch.mm(a, a.t()) + 1e-05 * torch.eye(3) # make symmetric positive definite - >>> u = torch.cholesky(a) + >>> u = torch.linalg.cholesky(a) >>> a tensor([[ 0.9935, -0.6353, 1.5806], [ -0.6353, 0.8769, -1.7183], @@ -2336,6 +2341,12 @@ def merge_dicts(*dicts): tensor([[ 1.9314, 1.2251, -0.0889], [ 1.2251, 2.4439, 0.2122], [-0.0889, 0.2122, 0.1412]]) + >>> a = torch.randn(3, 2, 2) # Example for batched input + >>> a = a @ a.mT + 1e-03 # make symmetric positive-definite + >>> l = torch.linalg.cholesky(a) + >>> z = l @ l.mT + >>> torch.dist(z, a) + tensor(3.5894e-07) """) add_docstr(torch.clone, r"""