forked from PaddlePaddle/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
【PaddlePaddle Hackathon 3】13 新增 API triu_indices (PaddlePaddle#5161)
- Loading branch information
Showing
2 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
.. _cn_api_tensor_triu_indices: | ||
|
||
triu_indices | ||
-------------------------------- | ||
|
||
.. py:function:: paddle.triu_indices(row, col=None, offset=0, dtype='int64') | ||
返回行数和列数已知的二维矩阵中上三角矩阵元素的行列坐标,坐标的顺序首先按照行号排列,其次按照列号排列,所述上三角矩阵为原始矩阵某一对角线右上部分元素的子矩阵。 | ||
|
||
参数 | ||
::::::::: | ||
- **row** (int) - 输入 x 是描述矩阵的行数的一个 int 类型数值。 | ||
- **col** (int,可选) - 输入 x 是描述矩阵的列数的一个 int 类型数值,col 输入默认为 None,此时将 col 设置为 row 的取值,代表输入为正方形矩阵。 | ||
- **offset** (int,可选) - 确定所要考虑的对角线的位置,默认值为 0。 | ||
|
||
+ 如果 offset = 0,取主对角线。 | ||
+ 如果 offset > 0,取主对角线右上的对角线,所包含的元素减少。 | ||
+ 如果 offset < 0,取主对角线左下的对角线,所排除的元素减少。 | ||
|
||
- **dtype** (str|np.dtype|paddle.dtype,可选) - 指定输出张量的数据类型,可以是 int32,int64,默认值为 int64。 | ||
|
||
返回 | ||
::::::::: | ||
Tensor,返回 row*col 大小矩阵的上三角元素的坐标,其中第一行包含行坐标,第二行包含列坐标 | ||
|
||
代码示例 | ||
::::::::: | ||
|
||
COPY-FROM: paddle.triu_indices |