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

26 lines
1.4 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.TrilIndices
==========================
.. py:class:: mindspore.ops.TrilIndices(row, col, offset=0, dtype=mstype.int32)
返回一个包含 `row` * `col` 的矩阵的下三角形部分的索引的Tensor。Tensor的shape为 :math:`(2, tril\_size)` ,其中, `tril_size` 为下三角矩阵的元素总数。第一行包含所有索引的行坐标,第二行包含列坐标。索引按行排序,然后按列排序。
矩阵的下三角形部分定义为对角线本身和对角线以下的元素。
.. note::
在CUDA上运行的时候 `row` * `col` 必须小于2^59以防止计算时溢出。
参数:
- **row** (int) - 2-D 矩阵的行数。
- **col** (int) - 2-D 矩阵的列数。
- **offset** (int, 可选) - 对角线偏移量。默认值0。
- **dtype** (:class:`mindspore.dtype`, 可选) - 指定输出Tensor数据类型支持的数据类型为 `mstype.int32``mstype.int64` ,默认值: `mstype.int32`
输出:
- **y** (Tensor) - 矩阵的下三角形部分的索引。数据类型由 `dtype` 指定shape为 :math:`(2, tril\_size)` ,其中, `tril_size` 为下三角矩阵的元素总数。
异常:
- **TypeError** - 如果 `row``col``offset` 不是int。
- **TypeError** - 如果 `dtype` 的类型不是int32或int64。
- **ValueError** - 如果 `row` 或者 `col` 小于零。