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.44] repeat_interleave -part #6988

Merged
merged 3 commits into from
Dec 11, 2024

Conversation

yangrongxinuser
Copy link
Contributor

Add image of expand and rewrite repeat_interleave_cn.rst
中文文档链接:docs/api/paddle/ repeat_interleave_cn.rst
@tianhaodongbd
@sunzhongkai588

Copy link

paddle-bot bot commented Nov 20, 2024

感谢你贡献飞桨文档,文档预览构建中,Docs-New 跑完后即可预览,预览链接:http://preview-pr-6988.paddle-docs-preview.paddlepaddle.org.cn/documentation/docs/zh/api/index_cn.html
预览工具的更多说明,请参考:飞桨文档预览工具

@CLAassistant
Copy link

CLAassistant commented Nov 20, 2024

CLA assistant check
All committers have signed the CLA.

@yangrongxinuser
Copy link
Contributor Author

Comment on lines 8 to 10
tensor.repeat_interleave 按指定次数重复张量的每个元素。
以上图为例,输入张量 [[1, 2, 3], [4, 5, 6]],重复次数为 [3, 2, 1],表示第1列元素重复3次,第2列重复2次,第3列重复1次。
最终输出为一维张量 [1, 1, 1, 2, 2, 3, 4, 4, 4, 5, 5, 6]。
Copy link
Collaborator

Choose a reason for hiding this comment

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

  • 图例说明放在 API 说明简介的下面,参数部分的上面,参考示例 PR
  • 图例说明里要引用图片,才会在文档里显示
  • 这段说明里似乎也是错的,没有说明参数 axis 的值。看起来是按列重复。那说明参数 axis=1,最终结果不应该是 [[1, 1, 1, 2, 2, 3], [4, 4, 4, 5, 5, 6]] 么,而且你的说明和图例最终结果也不一致

请仔细攥写文档,确保图例说明和图例一致,输入输出、重要的参数均要注明并且确保正确,自己跑一遍代码试试。并且站在阅读文档的开发者角度写图例

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Snipaste_2024-12-05_11-05-18
我的结果是按照示例修改的,没有问题哇

Copy link
Contributor Author

Choose a reason for hiding this comment

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

是按列重复,参数 axis=1,结果是没有问题的

Copy link
Collaborator

Choose a reason for hiding this comment

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

  • 二维 tensor 以矩阵的样式表示就行,参考下图,并标明 axis=0 和axis =1
    image
  • 加上参数 axis 的值

@@ -4,9 +4,17 @@ repeat_interleave
-------------------------------

.. py:function:: paddle.repeat_interleave(x, repeats, axis=None, name=None)
沿着指定轴 ``axis`` 对输入 ``x`` 进行复制,创建并返回到一个新的 Tensor。当 ``repeats`` 为 ``1-D`` Tensor 时,``repeats`` 长度必须和指定轴 ``axis`` 维度一致,``repeats`` 对应位置的值表示 ``x`` 对应位置元素需要复制的次数。当 ``repeats`` 为 int 时,``x`` 沿指定轴 ``axis`` 上所有元素复制 ``repeats`` 次。
tensor.repeat_interleave 按指定次数重复张量的每个元素。
Copy link
Collaborator

Choose a reason for hiding this comment

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

tensor.repeat_interleave 是 ? 这句话直接删了吧

Suggested change
tensor.repeat_interleave 按指定次数重复张量的每个元素。

Comment on lines 11 to 12
以下图为例,输入张量 [[1, 2, 3], [4, 5, 6]],重复次数为 [3, 2, 1],表示第1列元素重复3次,第2列重复2次,第3列重复1次。
最终输出为二维张量 [[1, 1, 1, 2, 2, 3], [4, 4, 4, 5, 5, 6]]。
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
以下图为例,输入张量 [[1, 2, 3], [4, 5, 6]],重复次数为 [3, 2, 1],表示第1列元素重复3次,第2列重复2次,第3列重复1次。
最终输出为二维张量 [[1, 1, 1, 2, 2, 3], [4, 4, 4, 5, 5, 6]]。
以下图为例,输入张量 ``[[1, 2, 3], [4, 5, 6]]``,重复次数 ``repeats`` 为 [3, 2, 1],参数 ``axis =1``,表示第 1 列元素重复 3 次,第 2 列重复 2 次,第 3 列重复 1 次。
最终输出为二维张量 ``[[1, 1, 1, 2, 2, 3], [4, 4, 4, 5, 5, 6]]``。

Comment on lines 34 to 48
* 示例 1(输入为 2-D Tensor X 和 1-D Tensor repeats):

输入:
X = [[1, 2, 3][4, 5, 6]]
repeats = [3, 2, 1]


参数:
axis = 1
name = None

输出:
Out = [[1, 1, 1, 2, 2, 3],[4, 4, 4, 5, 5, 6]]


Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* 示例 1(输入为 2-D Tensor X 和 1-D Tensor repeats):
输入:
X = [[1, 2, 3][4, 5, 6]]
repeats = [3, 2, 1]
参数:
axis = 1
name = None
输出:
Out = [[1, 1, 1, 2, 2, 3],[4, 4, 4, 5, 5, 6]]

Copy link
Collaborator

Choose a reason for hiding this comment

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

  • axis = 0 和 axis = 1 搞反了
  • 沿着 axis=1 复制 改成英文或直接写 axis=1,因为图例还要用在英文文档

@yangrongxinuser
Copy link
Contributor Author

@sunzhongkai588 辛苦老师看看还有什么问题

@yangrongxinuser
Copy link
Contributor Author

Copy link
Collaborator

@sunzhongkai588 sunzhongkai588 left a comment

Choose a reason for hiding this comment

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

LGTM~英文文档也加一下吧

@luotao1 luotao1 changed the title [SCU][Docathon][Add API Legend No.44] repeat_interleave [SCU][Docathon][Add API Legend No.44] repeat_interleave -part Dec 11, 2024
@luotao1 luotao1 merged commit c820a79 into PaddlePaddle:develop Dec 11, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor HappyOpenSource Pro 进阶版快乐开源活动,更具挑战性的任务
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants