svdvals¶
- paddle.linalg. svdvals ( x: Tensor, name: str | None = None ) Tensor [source]
-
Computes the singular values of one matrix or a batch of matrices.
Let \(X\) be the input matrix or a batch of input matrices, the output singular values \(S\) are the diagonal elements of the matrix produced by singular value decomposition:
\[X = U * diag(S) * V^{H}\]- Parameters
-
x (Tensor) – The input tensor. Its shape should be […, M, N], where … is zero or more batch dimensions. The data type of x should be float32 or float64.
name (str|None, optional) – Name for the operation. For more information, please refer to Name. Default: None.
- Returns
-
Singular values of x. The shape is […, K], where K = min(M, N).
- Return type
-
Tensor
Examples
>>> import paddle >>> x = paddle.to_tensor([[1.0, 2.0], [1.0, 3.0], [4.0, 6.0]]) >>> s = paddle.linalg.svdvals(x) >>> print(s) Tensor(shape=[2], dtype=float32, place=Place(cpu), stop_gradient=True, [8.14753819, 0.78589684])