mindspore/docs/api/api_python/ops/mindspore.ops.FillDiagonal.rst

22 lines
1.1 KiB
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.ops.FillDiagonal
==========================
.. py:class:: mindspore.ops.FillDiagonal(fill_value, wrap=False)
填充至少具有二维的Tensor的主对角线。当输入的维度大于2时所有维度必须等长。此函数原地修改输入Tensor并返回输入Tensor。
参数:
- **fill_value** (float) - `input_x` 对角线的填充值。
- **wrap** (bool可选) - 控制对于一个高矩阵即矩阵的行数大于列数对角线元素是否继续延伸到剩余的行。具体效果详见下方代码样例。默认值False。
输入:
- **input_x** (Tensor) - shape为 :math:`(x_1, x_2, ..., x_R)` 其数据类型必须为float32、int32或者int64。
输出:
- **y** (Tensor) - Tensor和输入 `input_x` 具有相同的shape和dtype。
异常:
- **TypeError** - 如果 `input_x` 的dtype不是float32、int32或者int64。
- **ValueError** - 如果 `input_x` 的维度没有大于1。
- **ValueError** - 当维度大于2时每个轴的大小不相等。