!45471 [MS][OP]add some primitive chinese docs

Merge pull request !45471 from mengyuanli/code_docs_export_primitive_2
This commit is contained in:
i-robot 2022-11-15 01:54:05 +00:00 committed by Gitee
commit 8bb913a613
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
7 changed files with 63 additions and 55 deletions

View File

@ -230,6 +230,9 @@ MindSpore中 `mindspore.ops` 接口与上一版本相比,新增、删除和支
mindspore.ops.Bincount
mindspore.ops.Bucketize
mindspore.ops.Cauchy
mindspore.ops.Cholesky
mindspore.ops.CholeskyInverse
mindspore.ops.CholeskySolve
mindspore.ops.Cross
逐元素运算

View File

@ -0,0 +1,8 @@
mindspore.ops.Cholesky
=======================
.. py:class:: mindspore.ops.Cholesky(upper=False)
计算单个或成批对称正定矩阵的Cholesky分解。
更多参考详见 :func:`mindspore.ops.cholesky`

View File

@ -0,0 +1,8 @@
mindspore.ops.CholeskyInverse
==============================
.. py:class:: mindspore.ops.CholeskyInverse(upper=False)
使用Cholesky矩阵分解返回正定矩阵的逆矩阵。
更多参考详见 :func:`mindspore.ops.cholesky_inverse`

View File

@ -0,0 +1,37 @@
mindspore.ops.CholeskySolve
===========================
.. py:class:: mindspore.ops.CholeskySolve(upper=False)
给定Cholesky因子 `u` ,求解具有正定矩阵的线性方程组,结果表示为 `c`
如果 `upper` 是True `u` 是上三角形矩阵,可以通过下面公式得到 `c`
.. math::
c = (u^{T}u)^{{-1}}b
如果 `upper` 是False `u` 是下三角形矩阵,可以通过下面公式得到 `c`
.. math::
c = (uu^{T})^{{-1}}b
参数:
- **upper** (bool可选) - 将Cholesky因子视为下三角矩阵或上三角矩阵的标志。若为True视为上三角矩阵反之则为下三角。默认值False。
输入:
- **x1** (Tensor) - 表示二维或三维矩阵的Tensor。Shape为 :math:`(*, N, M)` 数据类型为float32或float64。
- **x2** (Tensor) - 表示由2D或3D正方形矩阵组成上三角形或下三角形乔列斯基因子的Tensor。Shape为 :math:`(*, N, N)` 数据类型为float32或float64。
`x1``x2` 必须具有相同的类型。
输出:
Tensor具有与 `x1` 相同的shape和数据类型。
异常:
- **TypeError** - `upper` 的数据类型不是bool。
- **TypeError** - 如果 `x1``x2` 的dtype不是以下之一float64float32。
- **TypeError** - 如果 `x1` 不是Tensor。
- **TypeError** - 如果 `x2` 不是Tensor。
- **ValueError** - 如果 `x1``x2` 具有不同的批大小。
- **ValueError** - 如果 `x1``x2` 具有不同的行数。
- **ValueError** - 如果 `x1` 不是2维或3维矩阵。
- **ValueError** - 如果 `x2` 不是2维或3维方阵。

View File

@ -230,6 +230,9 @@ Mathematical Operators
mindspore.ops.Bincount
mindspore.ops.Bucketize
mindspore.ops.Cauchy
mindspore.ops.Cholesky
mindspore.ops.CholeskyInverse
mindspore.ops.CholeskySolve
mindspore.ops.Cross
Element-wise Operator

View File

@ -6766,7 +6766,7 @@ def cholesky_inverse(input_x, upper=False):
ValueError: If the dimension of `input_x` is not equal to 2.
Supported Platforms:
``CPU``
``GPU`` ``CPU``
Examples:
>>> input_x = Tensor(np.array([[2,0,0], [4,1,0], [-1,1,2]]), mindspore.float32)

View File

@ -6422,32 +6422,7 @@ class CholeskyInverse(Primitive):
"""
Returns the inverse of the positive definite matrix using cholesky matrix factorization.
If upper is False, u is a lower triangular such that the output tensor is
.. math::
inv = (uu^{T})^{{-1}}
If upper is True, u is an upper triangular such that the output tensor is
.. math::
inv = (u^{T}u)^{{-1}}
Note:
The input must be either an upper triangular matrix or a lower triangular matrix.
Args:
upper(bool): Whether to return a lower or upper triangular matrix. Default: False.
Inputs:
- **x** (Tensor) - The input tensor. types: float32, float64.
Outputs:
Tensor, has the same shape and dtype as x.
Raises:
TypeError: If `x` is not a Tensor.
TypeError: If dtype of `x` is not one of: float32, float64.
ValueError: If the dimension of `x` is not equal to 2.
Refer to :func::`mindspore.ops.cholesky_inverse` for more detail.
Supported Platforms:
``GPU`` ``CPU``
@ -6793,33 +6768,7 @@ class Cholesky(Primitive):
Computes the Cholesky decomposition of a symmetric positive-definite matrix `A`
or for batches of symmetric positive-definite matrices.
If `upper` is `True`, the returned matrix `U` is upper-triangular, and the decomposition has the form:
.. math::
A = U^TU
If `upper` is `False`, the returned matrix `L` is lower-triangular, and the decomposition has the form:
.. math::
A = LL^T
Args:
upper (bool): Flag that indicates whether to return a upper or lower triangular matrix.
Default: False.
Inputs:
- **input_x** (Tensor) - Tensor of shape :math:`(*, N, N)`, where :math:`*` is zero or more batch dimensions
consisting of symmetric positive-definite matrices, with float32 or float64 data type.
Outputs:
Tensor, has the same shape and data type as `input_x`.
Raises:
TypeError: If `upper` is not a bool.
TypeError: If dtype of `input_x` is not one of: float64, float32.
TypeError: If `input_x` is not a Tensor.
ValueError: If `input_x` is not batch square.
ValueError: If `input_x` is not symmetric positive definite.
Refer to :func::`mindspore.ops.cholesky` for more detail.
Supported Platforms:
``Ascend`` ``CPU``
@ -6904,7 +6853,7 @@ class CholeskySolve(Primitive):
c = (uu^{T})^{{-1}}b
Args:
upper (bool): Flag which indicates whether to consider the Cholesky factor
upper (bool, optional): Flag which indicates whether to consider the Cholesky factor
as a lower or upper triangular matrix. Default: False.
Inputs: