mindspore/docs/api/api_python/nn/mindspore.nn.MatrixDiagPart...

17 lines
755 B
ReStructuredText
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

mindspore.nn.MatrixDiagPart
============================
.. py:class:: mindspore.nn.MatrixDiagPart
返回批对角矩阵的对角线部分。
假设 `x`:math:`k` 个维度 :math:`[I, J, K, ..., M, N]` ,则输出秩为 :math:`k-1` 且维度为 :math:`[I, J, K, ..., min(M, N)]` 的Tensor其中 :math:`output[i, j, k, ..., n] = x[i, j, k, ..., n, n]`
输入:
- **x** (Tensor) - 输入具有批对角的Tensor。支持的数据类型包括float32、float16、int32、int8和uint8。
输出:
Tensorshape与输入 `x` 相同。shape必须为 :math:`x.shape[:-2]+[min(x.shape[-2:])]`
异常:
- **TypeError** - `x` 的数据类型不是float32、float16、int32、int8或uint8。