Svd
English | 简体中文
Product Support Status
| Product | Supported |
|---|---|
| Ascend 950PR&950DT products | × |
| Atlas A3 products | √ |
| Atlas A2 products | √ |
| Atlas 200I/500 A2 inference products | × |
| Atlas inference products | × |
| Atlas training products | × |
Function Description
-
API function: computes the singular value decomposition of one or more matrices.
When the dimension of the input tensor is greater than 2, the high-dimensional tensor is treated as a batch of matrices. For an input tensor with the shape (..., M, N), the dimensions (...) before the second-to-last dimension are regarded as batch dimensions, and the singular value decomposition is computed independently for each (M, N) matrix.
-
Computation formula:
input=U×diag(sigma)×VT\mathbf{input} = \mathbf{U} \times \mathrm{diag}(\boldsymbol{sigma}) \times \mathbf{V}^T
| Parameter Name | Input/Output/Attribute | Description | Data Type | Data Format |
|---|---|---|---|---|
| input | Input | Tensor on which the singular value decomposition is to be performed, corresponding to input in the formula. Empty tensors are not supported. The shape has at least 2 dimensions. |
FLOAT, DOUBLE, COMPLEX64, COMPLEX128 | ND |
| sigma | Output | Output tensor, corresponding to sigma in the formula. The shape needs to be deduced based on the shape of input and the fullMatrices parameter. The data type must be the same as that of input. |
FLOAT, DOUBLE, COMPLEX64, COMPLEX128 | ND |
| U | Output | Output tensor, corresponding to U in the formula. The shape needs to be deduced based on the shape of input and the fullMatrices parameter. The data type must be the same as that of input. |
FLOAT, DOUBLE, COMPLEX64, COMPLEX128 | ND |
| V | Output | Output tensor, corresponding to V in the formula. The shape needs to be deduced based on the shape of input and the fullMatrices parameter. The data type must be the same as that of input. |
FLOAT, DOUBLE, COMPLEX64, COMPLEX128 | ND |
| compute_uv | Attribute | Optional attribute. The default value is true. Denotes whether to compute the output tensors u and v. If set to true, the output tensors sigma, u, and v are all computed. If set to false, only sigma is computed. | BOOL | true/false |
| full_matrices | Attribute | Optional attribute. Denotes whether to compute the output tensors u and v completely. The default value is false. | BOOL | true/false |
Constraint Description
None
Invocation Description
| Invocation Method | Invocation Sample | Description |
|---|---|---|
| aclnn invocation | test_aclnn_svd | Invokes the Svd operator through the aclnnSvd API. |