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

22 lines
813 B
ReStructuredText
Raw Normal View History

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