forked from mindspore-Ecosystem/mindspore
22 lines
765 B
ReStructuredText
22 lines
765 B
ReStructuredText
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]`。
|