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

22 lines
813 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.ops.Triu
===================
.. py:class:: mindspore.ops.Triu(diagonal=0)
返回单个矩阵上三角形部分,其他位置的元素将被置零。
矩阵的上三角形部分定义为对角线和对角线上方的元素。
参数:
- **diagonal** (int可选) - 可选参数指定对角线位置默认值0指定主对角线。
输入:
- **x** (Tensor) - 输入Tensor。shape为 :math:`(N, *)` ,其中 * 为任意数量的额外维度。其数据类型为数值型。
输出:
- **y** (Tensor) - 数据类型和shape维度与输入相同。
异常:
- **TypeError** - 如果 `x` 不是Tensor。
- **TypeError** - 如果 `diagonal` 不是int类型。
- **ValueError** - 如果 `x` 的shape长度小于1。