mindspore.ops.svd ================== .. image:: https://mindspore-website.obs.cn-north-4.myhuaweicloud.com/website-images/master/resource/_static/logo_source.svg :target: https://gitee.com/mindspore/mindspore/blob/master/docs/api/api_python/ops/mindspore.ops.func_svd.rst :alt: 查看源文件 .. py:function:: mindspore.ops.svd(input, full_matrices=False, compute_uv=True) 计算单个或多个矩阵的奇异值分解。 设矩阵 :math:`A` ,svd返回奇异值 :math:`S` 、左奇异向量 :math:`U` 和右奇异向量 :math:`V` 。满足以下公式: .. math:: A=U*diag(S)*V^{T} 参数: - **input** (Tensor) - 输入tensor,shape为 :math:`(*, M, N)` 。 - **full_matrices** (bool, 可选) - 如果为 ``True`` ,则计算完整的 :math:`U` 和 :math:`V` 。否则仅计算前P个奇异向量,P为M和N中的较小值。默认 ``False`` 。 - **compute_uv** (bool, 可选) - 如果为 ``True`` ,则计算 :math:`U` 和 :math:`V` ,否则只计算 :math:`S` 。默认 ``True`` 。 返回: 如果 `compute_uv` 为 ``True`` ,返回三个tensor组成的tuple( `s` , `u` , `v`)。否则,返回单个tensor -> `s` 。 - `s` 是奇异值tensor。shape为 :math:`(*, P)` 。 - `u` 是左奇异tensor。如果 `compute_uv` 为 ``False`` ,该值不会返回。shape为 :math:`(*, M, P)` 。如果 `full_matrices` 为 ``True`` ,则shape为 :math:`(*, M, M)` 。 - `v` 是右奇异tensor。如果 `compute_uv` 为 ``False`` ,该值不会返回。shape为 :math:`(*, N, P)` 。如果 `full_matrices` 为 ``True`` ,则shape为 :math:`(*, N, N)` 。