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

fix nn.Pad1D/2D/3D class issue #5126

Closed
wants to merge 7 commits into from

Conversation

liyongchao911
Copy link
Contributor

@liyongchao911 liyongchao911 commented Aug 11, 2022

  1. 文档参数部分,对于默认参数加上可选,optional标识,与其他文档保持一致
  2. 示例代码部分可以将numpy.prod改成paddle.prod, 并删除import numpy as np

PADDLEPADDLE_PR=45068

COPY-FROM: paddle.multiplex:code-example1
=======
COPY-FROM: paddle.multiplex:code-example1
>>>>>>> 946e985763dcc3ae0f029147b8141c3af4fd9d9a
Copy link
Member

Choose a reason for hiding this comment

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

这里处理冲突出问题啦~

@@ -13,11 +13,11 @@ Pad1D

- **padding** (Tensor | List[int] | int) - 填充大小。如果是int,则在所有待填充边界使用相同的填充,
否则填充的格式为[pad_left, pad_right]。
- **mode** (str) - padding的四种模式,分别为 ``'constant'``, ``'reflect'``, ``'replicate'`` 和 ``'circular'``。
- **mode** (str, 可选) - padding的四种模式,分别为 ``'constant'``, ``'reflect'``, ``'replicate'`` 和 ``'circular'``。
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- **mode** (str, 可选) - padding的四种模式,分别为 ``'constant'``, ``'reflect'``, ``'replicate'`` 和 ``'circular'``。
- **mode** (str可选) - padding的四种模式,分别为 ``'constant'``, ``'reflect'``, ``'replicate'`` 和 ``'circular'``。

这里是中文逗号~

@@ -31,11 +31,11 @@ Pad1D

import paddle
import paddle.nn as nn
import numpy as np

Copy link
Member

Choose a reason for hiding this comment

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

示例代码直接 COPY-FROM 吧,如果 copy 失败了可以找我,我们一起解决呀~

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

print(result)
# [[[0. 1. 2. 3. 0. 0.]
# [0. 4. 5. 6. 0. 0.]]]
COPY-FROM: Paddle.nn.layer.common.Pad1D(Layer):code-example1
Copy link
Member

@SigureMo SigureMo Aug 11, 2022

Choose a reason for hiding this comment

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

这里格式不太对
COPY-FROM: paddle.nn.Pad1D

在确定唯一的情况下,不建议加一个 :name: 属性哒,英文那面也删一下

看下面的 review 消息,直接 merge 上游修改即可,因为这些上游改过了,当然英文那面也是不需要加 :name:

- **value** (float32, 可选) - 以 ``'constant'`` 模式填充区域时填充的值。默认值为0.0。
- **data_format** (str, 可选) - 指定输入的format,可为 ``'NCL'`` 或者 ``'NLC'``,默认值为 ``'NCL'``。
- **name** (str, 可选) - 该参数供开发人员打印调试信息时使用,具体用法请参见 :ref:`api_guide_Name` ,缺省值为None。
- **value** (float32, 可选) - 以 ``'constant'`` 模式填充区域时填充的值。默认值为0.0。
Copy link
Member

Choose a reason for hiding this comment

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

改为中文逗号后后面不需要加空格

Copy link
Member

@SigureMo SigureMo Aug 11, 2022

Choose a reason for hiding this comment

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

注意本地需要用 pre-commit 来处理下代码风格的问题,比如这里中英文(数字)之间要有空格

如果本地是大小写不敏感的文件系统,安装 pre-commit 后无法成功 commit,可以尝试逐个文件进行修复。

pre-commit run --files <file_name>

Copy link
Member

Choose a reason for hiding this comment

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

这里应该直接写 floatfloat32 不是 Python 原生的数据类型

Copy link
Member

Choose a reason for hiding this comment

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

:math:`0.0`

这里的数字默认值可以这样写~

Copy link
Member

@SigureMo SigureMo left a comment

Choose a reason for hiding this comment

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

辛苦先合并下上游修改~

@@ -13,12 +13,12 @@ Pad1D

- **padding** (Tensor | List[int] | int) - 填充大小。如果是int,则在所有待填充边界使用相同的填充,
否则填充的格式为[pad_left, pad_right]。
Copy link
Member

Choose a reason for hiding this comment

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

list[int] 统一小写吧,英文一起改下

中文的话,同一个参数不需要折行,折行会在中间加空格。

这里的 如果是int 中间不应该没有空格,是不是没有合并上游修改,现在最新的 develop 是这样的:

image

COPY-FROM 我也在那个 PR 里加了,所以重新合并下上游吧

- **value** (float32, 可选) - 以 ``'constant'`` 模式填充区域时填充的值。默认值为0.0。
- **data_format** (str, 可选) - 指定输入的format,可为 ``'NCL'`` 或者 ``'NLC'``,默认值为 ``'NCL'``。
- **name** (str, 可选) - 该参数供开发人员打印调试信息时使用,具体用法请参见 :ref:`api_guide_Name` ,缺省值为None。
- **value** (float32, 可选) - 以 ``'constant'`` 模式填充区域时填充的值。默认值为0.0。
Copy link
Member

Choose a reason for hiding this comment

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

这里应该直接写 floatfloat32 不是 Python 原生的数据类型

- **name** (str, 可选) - 该参数供开发人员打印调试信息时使用,具体用法请参见 :ref:`api_guide_Name` ,缺省值为None。
- **value** (float32, 可选) - 以 ``'constant'`` 模式填充区域时填充的值。默认值为0.0。
- **data_format** (str, 可选) - 指定输入的format,可为 ``'NCL'`` 或者 ``'NLC'``,默认值为 ``'NCL'``。
- **name** (str 可选) - 该参数供开发人员打印调试信息时使用,具体用法请参见 :ref:`api_guide_Name` ,缺省值为None。
Copy link
Member

Choose a reason for hiding this comment

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

这里可以改成这个:

name (str,可选) - 具体用法请参见 :ref:`api_guide_Name` ,一般无需设置,默认值为 None。

英文可同步修改为:

name (str, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: None.

可能需要注意 copy 过来后改一下格式~

- **value** (float32, 可选) - 以 ``'constant'`` 模式填充区域时填充的值。默认值为0.0。
- **data_format** (str, 可选) - 指定输入的format,可为 ``'NCL'`` 或者 ``'NLC'``,默认值为 ``'NCL'``。
- **name** (str, 可选) - 该参数供开发人员打印调试信息时使用,具体用法请参见 :ref:`api_guide_Name` ,缺省值为None。
- **value** (float32, 可选) - 以 ``'constant'`` 模式填充区域时填充的值。默认值为0.0。
Copy link
Member

Choose a reason for hiding this comment

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

:math:`0.0`

这里的数字默认值可以这样写~

@liyongchao911
Copy link
Contributor Author

liyongchao911 commented Aug 15, 2022

issue a new PR #5136 instead!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants