@@ -825,6 +825,51 @@ def parse_kwargs(desc):
825
825
tensor([-2.1763, -0.4713, -0.6986, 1.3702])
826
826
""" )
827
827
828
+ add_docstr (torch .cholesky , r"""
829
+ cholesky(a, upper=False, out=None) -> Tensor
830
+
831
+ Computes the Cholesky decomposition of a symmetric positive-definite
832
+ matrix :math:`A`.
833
+
834
+ If :attr:`upper` is ``True``, the returned matrix `U` is upper-triangular, and
835
+ the decomposition has the form:
836
+
837
+ .. math::
838
+
839
+ A = U^TU
840
+
841
+ If :attr:`upper` is ``False``, the returned matrix `L` is lower-triangular, and
842
+ the decomposition has the form:
843
+
844
+ .. math::
845
+
846
+ A = LL^T
847
+
848
+ Args:
849
+ a (Tensor): the input 2-D tensor, a symmetric positive-definite matrix
850
+ upper (bool, optional): flag that indicates whether to return the
851
+ upper or lower triangular matrix. Default: ``False``
852
+ out (Tensor, optional): the output matrix
853
+
854
+ Example::
855
+
856
+ >>> a = torch.randn(3, 3)
857
+ >>> a = torch.mm(a, a.t()) # make symmetric positive definite
858
+ >>> l = torch.cholesky(a)
859
+ >>> a
860
+ tensor([[ 2.4112, -0.7486, 1.4551],
861
+ [-0.7486, 1.3544, 0.1294],
862
+ [ 1.4551, 0.1294, 1.6724]])
863
+ >>> l
864
+ tensor([[ 1.5528, 0.0000, 0.0000],
865
+ [-0.4821, 1.0592, 0.0000],
866
+ [ 0.9371, 0.5487, 0.7023]])
867
+ >>> torch.mm(l, l.t())
868
+ tensor([[ 2.4112, -0.7486, 1.4551],
869
+ [-0.7486, 1.3544, 0.1294],
870
+ [ 1.4551, 0.1294, 1.6724]])
871
+ """ )
872
+
828
873
add_docstr (torch .clamp ,
829
874
r"""
830
875
clamp(input, min, max, out=None) -> Tensor
@@ -3249,51 +3294,6 @@ def parse_kwargs(desc):
3249
3294
3250
3295
""" )
3251
3296
3252
- add_docstr (torch .potrf , r"""
3253
- potrf(a, upper=True, out=None) -> Tensor
3254
-
3255
- Computes the Cholesky decomposition of a symmetric positive-definite
3256
- matrix :math:`A`.
3257
-
3258
- If :attr:`upper` is ``True``, the returned matrix `U` is upper-triangular, and
3259
- the decomposition has the form:
3260
-
3261
- .. math::
3262
-
3263
- A = U^TU
3264
-
3265
- If :attr:`upper` is ``False``, the returned matrix `L` is lower-triangular, and
3266
- the decomposition has the form:
3267
-
3268
- .. math::
3269
-
3270
- A = LL^T
3271
-
3272
- Args:
3273
- a (Tensor): the input 2-D tensor, a symmetric positive-definite matrix
3274
- upper (bool, optional): flag that indicates whether to return the
3275
- upper or lower triangular matrix
3276
- out (Tensor, optional): the output matrix
3277
-
3278
- Example::
3279
-
3280
- >>> a = torch.randn(3, 3)
3281
- >>> a = torch.mm(a, a.t()) # make symmetric positive definite
3282
- >>> u = torch.potrf(a)
3283
- >>> a
3284
- tensor([[ 2.4112, -0.7486, 1.4551],
3285
- [-0.7486, 1.3544, 0.1294],
3286
- [ 1.4551, 0.1294, 1.6724]])
3287
- >>> u
3288
- tensor([[ 1.5528, -0.4821, 0.9371],
3289
- [ 0.0000, 1.0592, 0.5486],
3290
- [ 0.0000, 0.0000, 0.7023]])
3291
- >>> torch.mm(u.t(), u)
3292
- tensor([[ 2.4112, -0.7486, 1.4551],
3293
- [-0.7486, 1.3544, 0.1294],
3294
- [ 1.4551, 0.1294, 1.6724]])
3295
- """ )
3296
-
3297
3297
add_docstr (torch .potri , r"""
3298
3298
potri(u, upper=True, out=None) -> Tensor
3299
3299
@@ -3322,7 +3322,7 @@ def parse_kwargs(desc):
3322
3322
3323
3323
>>> a = torch.randn(3, 3)
3324
3324
>>> a = torch.mm(a, a.t()) # make symmetric positive definite
3325
- >>> u = torch.potrf (a)
3325
+ >>> u = torch.cholesky (a)
3326
3326
>>> a
3327
3327
tensor([[ 0.9935, -0.6353, 1.5806],
3328
3328
[ -0.6353, 0.8769, -1.7183],
@@ -3367,7 +3367,7 @@ def parse_kwargs(desc):
3367
3367
3368
3368
>>> a = torch.randn(3, 3)
3369
3369
>>> a = torch.mm(a, a.t()) # make symmetric positive definite
3370
- >>> u = torch.potrf (a)
3370
+ >>> u = torch.cholesky (a)
3371
3371
>>> a
3372
3372
tensor([[ 0.7747, -1.9549, 1.3086],
3373
3373
[-1.9549, 6.7546, -5.4114],
0 commit comments