-
Notifications
You must be signed in to change notification settings - Fork 762
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
[SCU][Docathon][Add API Legend No.39]add the picture of unique-consecutive #6967
base: develop
Are you sure you want to change the base?
Changes from all commits
2eb5358
0d61607
81042f3
aed2fb3
3bdb255
8d72930
7dd53e5
0eb36e9
62cefa5
b8b6b1f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,26 +5,40 @@ unique_consecutive | |
|
||
.. py:function:: paddle.unique_consecutive(x, return_inverse=False, return_counts=False, axis=None, dtype="int64", name=None) | ||
|
||
将 Tensor 中连续重复的元素进行去重,返回连续不重复的 Tensor。 | ||
将 Tensor 中连续重复的元素进行去重,返回连续不重复的 Tensor 。 | ||
|
||
|
||
参数 | ||
:::::::::::: | ||
|
||
- **x** (Tensor) - 输入的 `Tensor`,数据类型为:float32、float64、int32、int64。 | ||
- **return_inverse** (bool,可选) - 如果为 True,则还返回输入 Tensor 的元素对应在连续不重复元素中的索引,该索引可用于重构输入 Tensor。默认:False。 | ||
- **return_counts** (bool,可选) - 如果为 True,则还返回每个连续不重复元素在输入 Tensor 中的个数。默认:False。 | ||
- **axis** (int,可选) - 指定选取连续不重复元素的轴。默认值为 None,将输入平铺为 1-D 的 Tensor 后再选取连续不重复元素。默认:None。 | ||
- **dtype** (np.dtype|str,可选) - 用于设置 `inverse` 或者 `counts` 的类型,应该为 int32 或者 int64。默认:int64。 | ||
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。 | ||
- **x** (Tensor) - 输入的 `Tensor` ,数据类型为: float32、float64、int32、int64。 | ||
- **return_inverse** (bool ,可选 ) - 如果为 True ,则还返回输入 Tensor 的元素对应在连续不重复元素中的索引,该索引可用于重构输入 Tensor 。默认: False。 | ||
- **return_counts** (bool ,可选 ) - 如果为 True ,则还返回每个连续不重复元素在输入 Tensor 中的个数。默认: False 。 | ||
- **axis** (int ,可选 ) - 指定选取连续不重复元素的轴。默认值为 None ,将输入平铺为 1-D 的 Tensor 后再选取连续不重复元素。默认: None 。 | ||
- **dtype** (np.dtype|str ,可选 ) - 用于设置 `inverse` 或者 `counts` 的类型,应该为 int32 或者 int64 。默认: int64 。 | ||
- **name** (str ,可选 ) - 具体用法请参见 :ref:`api_guide_Name` ,一般无需设置,默认值为 None 。 | ||
Comment on lines
+14
to
+19
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这些空格不需要增加 |
||
|
||
返回 | ||
:::::::::::: | ||
|
||
- **out** (Tensor) - 连续不重复元素构成的 Tensor,数据类型与输入一致。 | ||
- **inverse** (Tensor,可选) - 输入 Tensor 的元素对应在连续不重复元素中的索引,仅在 `return_inverse` 为 True 时返回。 | ||
- **counts** (Tensor,可选) - 每个连续不重复元素在输入 Tensor 中的个数,仅在 `return_counts` 为 True 时返回。 | ||
- **out** ( Tensor ) - 连续不重复元素构成的 Tensor ,数据类型与输入一致。 | ||
- **inverse** ( Tensor ,可选 ) - 输入 Tensor 的元素对应在连续不重复元素中的索引,仅在 ``return_inverse`` 为 True 时返回。 | ||
- **counts** ( Tensor ,可选) - 每个连续不重复元素在输入 Tensor 中的个数,仅在 ``return_counts`` 为 True 时返回。 | ||
|
||
|
||
上图展示了一个一维张量的去重过程 | ||
下图展示了一个 [3, 4] 的二维张量沿 axis = 0 展开后去重再进行二维折叠的过程 | ||
|
||
.. figure:: ../../images/api_legend/unique-consecutive.png | ||
:width: 500 | ||
:alt: 示例二图示 | ||
:align: center | ||
Comment on lines
+29
to
+35
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 图例部分加在 参数 板块上面,即API介绍的那部分 |
||
|
||
|
||
代码示例 | ||
:::::::::::: | ||
|
||
COPY-FROM: paddle.unique_consecutive | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 同理,为什么加了这么多空行 |
||
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这个是不是多余的? |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
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.
为什么加了空行