mindspore/docs/api/api_python/ops/mindspore.ops.func_svd.rst

26 lines
1.5 KiB
ReStructuredText
Raw Normal View History

mindspore.ops.svd
==================
.. py:function:: mindspore.ops.svd(a, full_matrices=False, compute_uv=True)
计算单个或多个矩阵的奇异值分解。
2022-05-16 16:55:57 +08:00
设矩阵 :math:`A` svd返回奇异值 :math:`S` 、左奇异向量 :math:`U` 和右奇异向量 :math:`V` 。满足以下公式:
.. math::
A=U*diag(S)*V^{T}
2022-07-26 10:27:56 +08:00
参数:
2022-11-02 19:28:41 +08:00
- **a** (Tensor) - 待分解的矩阵。shape为 :math:`(*, M, N)` 支持的数据类型为float32和float64。
2022-09-16 17:07:36 +08:00
- **full_matrices** (bool, 可选) - 如果为True则计算完整的 :math:`U`:math:`V` 。否则仅计算前P个奇异向量P为M和N中的较小值M和N分别是输入矩阵的行和列。默认值False。
2022-11-02 19:28:41 +08:00
- **compute_uv** (bool, 可选) - 如果这个参数为True则计算 :math:`U`:math:`V` ,否则只计算 :math:`S` 。默认值True。
2022-07-26 10:27:56 +08:00
返回:
- **s** (Tensor) - 奇异值。shape为 :math:`(*, P)`
- **u** (Tensor) - 左奇异向量。如果 `compute_uv` 为False该值不会返回。shape为 :math:`(*, M, P)` 。如果 `full_matrices` 为True则shape为 :math:`(*, M, M)`
2022-10-25 10:43:32 +08:00
- **v** (Tensor) - 右奇异向量。如果 `compute_uv` 为False该值不会返回。shape为 :math:`(*, N, P)` 。如果 `full_matrices` 为True则shape为 :math:`(*, N, N)`
2022-07-26 10:27:56 +08:00
异常:
- **TypeError** - `full_matrices``compute_uv` 不是bool类型。
- **TypeError** - 输入的rank小于2。
- **TypeError** - 输入的数据类型不为float32或float64。