mindspore/docs/api/api_python/nn/mindspore.nn.MatrixDiag.rst

17 lines
745 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.MatrixDiag
========================
.. py:class:: mindspore.nn.MatrixDiag
根据对角线值返回一批对角矩阵。
假设 `x`:math:`k` 个维度 :math:`[I, J, K, ..., N]` ,则输出秩为 :math:`k+1` 且维度为 :math:`[I, J, K, ..., N, N]` 的Tensor其中 :math:`output[i, j, k, ..., m, n] = 1\{m=n\} * x[i, j, k, ..., n]`
输入:
- **x** (Tensor) - 输入任意维度的对角线值。支持的数据类型包括float32、float16、int32、int8和uint8。
输出:
Tensorshape与输入 `x` 相同。Shape必须为 :math:`x.shape + (x.shape[-1], )`
异常:
- **TypeError** - `x` 的数据类型不是float32、float16、int32、int8或uint8。