Skip to content
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

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 24 additions & 10 deletions docs/api/paddle/unique_consecutive_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 。

Comment on lines +8 to +9
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为什么加了空行


参数
::::::::::::

- **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
Copy link
Collaborator

Choose a reason for hiding this comment

The 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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

图例部分加在 参数 板块上面,即API介绍的那部分



代码示例
::::::::::::

COPY-FROM: paddle.unique_consecutive

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同理,为什么加了这么多空行



Binary file added docs/images/api_legend/index_add.png
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个是不是多余的?

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/api_legend/unique-consecutive.png
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • sample1 的图例感觉反而弄复杂了更难理解了,比如 input_position 和 output_position 不知道用处在哪。尽量从开发者的角度来设计图例,尽量保持简洁明了
  • sample2 的 axis 弄反了, aixs=0是行,axis=1是列

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.