-
Notifications
You must be signed in to change notification settings - Fork 874
【PaddlePaddle Hackathon 3】13 新增 API triu_indices #5161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
示例代码中文没问题,英文那边在只有一个示例代码的情况下不推荐添加 name 属性
Examples: .. code-block:: python - :name: triu_indices-example # 删去 name 行 + # 中间空一行,避免将下一行解析为 rst directive 的属性 import paddle # example 1, default offset value data1 = paddle.triu_indices(4,4,0)