-
Notifications
You must be signed in to change notification settings - Fork 823
fix nn.Pad1D/2D/3D class issue #5126
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
Changes from all commits
78aeea7
1b9c397
f0969d5
30bed2b
1a883ed
89fdb03
a12d04a
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 |
---|---|---|
|
@@ -47,4 +47,6 @@ Tensor, 进行Multiplex运算后的输出Tensor。 | |
代码示例 | ||
:::::::::::: | ||
|
||
|
||
COPY-FROM: paddle.multiplex:code-example1 | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -13,12 +13,12 @@ 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'``。 | ||||||
``'constant'`` 表示填充常数 ``value`` ; ``'reflect'`` 表示填充以输入边界值为轴的映射;``'replicate'`` 表示 | ||||||
填充输入边界值; ``'circular'`` 为循环填充输入。默认值为 ``'constant'``。 | ||||||
- **value** (float32) - 以 ``'constant'`` 模式填充区域时填充的值。默认值为0.0。 | ||||||
- **data_format** (str) - 指定输入的format,可为 ``'NCL'`` 或者 ``'NLC'``,默认值为 ``'NCL'``。 | ||||||
- **name** (str, 可选) - 该参数供开发人员打印调试信息时使用,具体用法请参见 :ref:`api_guide_Name` ,缺省值为None。 | ||||||
- **value** (float32, 可选) - 以 ``'constant'`` 模式填充区域时填充的值。默认值为0.0。 | ||||||
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. 注意本地需要用 pre-commit 来处理下代码风格的问题,比如这里中英文(数字)之间要有空格 如果本地是大小写不敏感的文件系统,安装 pre-commit 后无法成功 commit,可以尝试逐个文件进行修复。 pre-commit run --files <file_name> 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.
这里的数字默认值可以这样写~ |
||||||
- **data_format** (str, 可选) - 指定输入的format,可为 ``'NCL'`` 或者 ``'NLC'``,默认值为 ``'NCL'``。 | ||||||
- **name** (str, 可选) - 该参数供开发人员打印调试信息时使用,具体用法请参见 :ref:`api_guide_Name` ,缺省值为None。 | ||||||
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. 这里可以改成这个: docs/docs/templates/common_docs.py Line 42 in 6dc68c9
英文可同步修改为: docs/docs/templates/common_docs.py Line 9 in 6dc68c9
可能需要注意 copy 过来后改一下格式~ |
||||||
|
||||||
返回 | ||||||
:::::::::::: | ||||||
|
@@ -27,17 +27,4 @@ Pad1D | |||||
代码示例 | ||||||
:::::::::::: | ||||||
|
||||||
.. code-block:: python | ||||||
|
||||||
import paddle | ||||||
import paddle.nn as nn | ||||||
import numpy as np | ||||||
input_shape = (1, 2, 3) | ||||||
pad = [1, 2] | ||||||
mode = "constant" | ||||||
data = paddle.arange(np.prod(input_shape), dtype="float32").reshape(input_shape) + 1 | ||||||
my_pad = nn.Pad1D(padding=pad, mode=mode) | ||||||
result = my_pad(data) | ||||||
print(result) | ||||||
# [[[0. 1. 2. 3. 0. 0.] | ||||||
# [0. 4. 5. 6. 0. 0.]]] | ||||||
COPY-FROM: Paddle.nn.layer.common.Pad1D(Layer):code-example1 | ||||||
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.
在确定唯一的情况下,不建议加一个 看下面的 review 消息,直接 merge 上游修改即可,因为这些上游改过了,当然英文那面也是不需要加 |
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.
list[int]
统一小写吧,英文一起改下中文的话,同一个参数不需要折行,折行会在中间加空格。
这里的
如果是int
中间不应该没有空格,是不是没有合并上游修改,现在最新的 develop 是这样的:COPY-FROM 我也在那个 PR 里加了,所以重新合并下上游吧