mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
Fix for ambiguity in linalg.norm()'s ord argument of +2 & -2 (#155148)
Fixes #136453 ### Description --- Fixed the ambiguity by referencing a hyperlink to wikipedia's SVD/Singular Values section as per past discussion (by other contributors) on the above thread. In the ord argument, for values `+2` and `-2`, the `singular value` now points to [this section of singular values on the wiki SVD page](https://en.wikipedia.org/wiki/Singular_value_decomposition#Singular_values,_singular_vectors,_and_their_relation_to_the_SVD). ### Why not mention SVD --- For conciseness (expanding 'largest singular value' -> 'largest singular value of a SVD' is too much, i think, wrt rest of the table) --- I hope this is satisfactory. Please let me know if I have missed anything essential; cheers. Pull Request resolved: https://github.com/pytorch/pytorch/pull/155148 Approved by: https://github.com/Skylion007, https://github.com/lezcano
This commit is contained in:
parent
b084e1b81c
commit
65a5eb8d27
|
|
@ -1369,9 +1369,9 @@ Whether this function computes a vector or matrix norm is determined as follows:
|
||||||
|
|
||||||
:attr:`ord` defines the norm that is computed. The following norms are supported:
|
:attr:`ord` defines the norm that is computed. The following norms are supported:
|
||||||
|
|
||||||
====================== ========================= ========================================================
|
====================== ========================== ======================================================
|
||||||
:attr:`ord` norm for matrices norm for vectors
|
:attr:`ord` norm for matrices norm for vectors
|
||||||
====================== ========================= ========================================================
|
====================== ========================== ======================================================
|
||||||
`None` (default) Frobenius norm `2`-norm (see below)
|
`None` (default) Frobenius norm `2`-norm (see below)
|
||||||
`'fro'` Frobenius norm -- not supported --
|
`'fro'` Frobenius norm -- not supported --
|
||||||
`'nuc'` nuclear norm -- not supported --
|
`'nuc'` nuclear norm -- not supported --
|
||||||
|
|
@ -1380,10 +1380,10 @@ Whether this function computes a vector or matrix norm is determined as follows:
|
||||||
`0` -- not supported -- `sum(x != 0)`
|
`0` -- not supported -- `sum(x != 0)`
|
||||||
`1` `max(sum(abs(x), dim=0))` as below
|
`1` `max(sum(abs(x), dim=0))` as below
|
||||||
`-1` `min(sum(abs(x), dim=0))` as below
|
`-1` `min(sum(abs(x), dim=0))` as below
|
||||||
`2` largest singular value as below
|
`2` largest `singular value`_ as below
|
||||||
`-2` smallest singular value as below
|
`-2` smallest `singular value`_ as below
|
||||||
other `int` or `float` -- not supported -- `sum(abs(x)^{ord})^{(1 / ord)}`
|
other `int` or `float` -- not supported -- `sum(abs(x)^{ord})^{(1 / ord)}`
|
||||||
====================== ========================= ========================================================
|
====================== ========================== ======================================================
|
||||||
|
|
||||||
where `inf` refers to `float('inf')`, NumPy's `inf` object, or any equivalent object.
|
where `inf` refers to `float('inf')`, NumPy's `inf` object, or any equivalent object.
|
||||||
|
|
||||||
|
|
@ -1483,6 +1483,9 @@ Using the :attr:`dim` argument to compute matrix norms::
|
||||||
tensor([ 3.7417, 11.2250])
|
tensor([ 3.7417, 11.2250])
|
||||||
>>> LA.norm(A[0, :, :]), LA.norm(A[1, :, :])
|
>>> LA.norm(A[0, :, :]), LA.norm(A[1, :, :])
|
||||||
(tensor(3.7417), tensor(11.2250))
|
(tensor(3.7417), tensor(11.2250))
|
||||||
|
|
||||||
|
.. _singular value:
|
||||||
|
https://en.wikipedia.org/wiki/Singular_value_decomposition#Singular_values,_singular_vectors,_and_their_relation_to_the_SVD
|
||||||
""",
|
""",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user