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

24 lines
1.0 KiB
ReStructuredText
Raw Permalink 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。
.. warning::
这是一个实验性API后续可能修改或删除。
参数:
- **fill_value** (float) - `input_x` 对角线的填充值。
- **wrap** (bool可选) - 对于一个高矩阵(即矩阵的行数大于列数),控制对角线元素是否继续延伸到剩余的行。具体效果详见下方代码样例。默认值: ``False``
输入:
- **input_x** (Tensor) - shape为 :math:`(x_1, x_2, ..., x_R)`
输出:
- **y** (Tensor) - Tensor和输入 `input_x` 具有相同的shape和dtype。
异常:
- **ValueError** - 如果 `input_x` 的维度没有大于1。
- **ValueError** - 当维度大于2时每个轴的大小不相等。