!45537 add document of DiagPart
Merge pull request !45537 from yangshuo/code_docs_api
This commit is contained in:
commit
62b3829598
|
@ -427,6 +427,7 @@ Array操作
|
|||
mindspore.ops.CumSum
|
||||
mindspore.ops.DataFormatDimMap
|
||||
mindspore.ops.DepthToSpace
|
||||
mindspore.ops.DiagPart
|
||||
mindspore.ops.DType
|
||||
mindspore.ops.ExpandDims
|
||||
mindspore.ops.FloatStatus
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
mindspore.ops.DiagPart
|
||||
======================
|
||||
|
||||
.. py:class:: mindspore.ops.DiagPart
|
||||
|
||||
返回输入的对角线部分。
|
||||
|
||||
假如`input_x`有维度`[D_1,..., D_k, D_1,..., D_k]`,那么输出是一个秩为k的Tensor,维度为`[D_1,..., D_k]`,其中:
|
||||
|
||||
`output[i_1,..., i_k] = input_x[i_1,..., i_k, i_1,..., i_k]`。
|
||||
|
||||
输入:
|
||||
- **input_x** (Tensor) - 输入Tensor。它的秩为`2k(k > 0)`。
|
||||
|
||||
输出:
|
||||
Tensor,与 `input` 有相同的数据类型。
|
||||
|
||||
异常:
|
||||
- **TypeError** - 如果 `input` 不是Tensor。
|
||||
- **ValueError** - 如果 `input` 的秩不是偶数,或为零。
|
||||
- **ValueError** - 如果 `input` 的shape不满足:`input_shape[i] == input_shape[i + len(input_shape)/2]`。
|
|
@ -427,6 +427,7 @@ Array Operation
|
|||
mindspore.ops.CumSum
|
||||
mindspore.ops.DataFormatDimMap
|
||||
mindspore.ops.DepthToSpace
|
||||
mindspore.ops.DiagPart
|
||||
mindspore.ops.DType
|
||||
mindspore.ops.ExpandDims
|
||||
mindspore.ops.FloatStatus
|
||||
|
|
|
@ -3533,7 +3533,7 @@ class DiagPart(PrimitiveWithCheck):
|
|||
:math:`output[i_1,..., i_k] = input[i_1,..., i_k, i_1,..., i_k]`.
|
||||
|
||||
Inputs:
|
||||
- **input_x** (Tensor) - The input tensor of rank 2k, k is not zero.
|
||||
- **input_x** (Tensor) - The rank of input tensor is 2k(k > 0).
|
||||
|
||||
Outputs:
|
||||
Tensor, the extracted diagonal has the same dtype as the `input_x`.
|
||||
|
|
Loading…
Reference in New Issue