-
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
update paddle.nn.Pad1D/2D/3D cn docs #5136
Conversation
感谢你贡献飞桨文档,文档预览构建中,Docs-New 跑完后即可预览,预览链接:http://preview-pr-5136.paddle-docs-preview.paddlepaddle.org.cn/documentation/docs/zh/api/index_cn.html |
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.
这几篇有相同的问题,辛苦修改一下~
此外可以一起修改下相应的 function API(paddle.nn.functional.pad
),我记得梦柳是建议成对修改的~
docs/api/paddle/nn/Pad1D_cn.rst
Outdated
@@ -11,13 +11,13 @@ Pad1D | |||
参数 | |||
:::::::::::: | |||
|
|||
- **padding** (Tensor | List[int] | int) - 填充大小。如果是 int,则在所有待填充边界使用相同的填充, | |||
- **padding** (Tensor|list[int]|int) - 填充大小。如果是 int,则在所有待填充边界使用相同的填充, |
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.
中文里同一个参数不建议折行,直接把下一行放在,
后面即可
docs/api/paddle/nn/Pad1D_cn.rst
Outdated
``'constant'`` 表示填充常数 ``value`` ; ``'reflect'`` 表示填充以输入边界值为轴的映射;``'replicate'`` 表示 | ||
填充输入边界值;``'circular'`` 为循环填充输入。默认值为 ``'constant'``。 | ||
- **value** (float32) - 以 ``'constant'`` 模式填充区域时填充的值。默认值为 0.0。 | ||
- **data_format** (str) - 指定输入的 format,可为 ``'NCL'`` 或者 ``'NLC'``,默认值为 ``'NCL'``。 | ||
- **value** (float,可选) - 以 ``'constant'`` 模式填充区域时填充的值。默认值为 0.0。 |
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.
这里的默认值用:
:math:`0.0`
docs/api/paddle/nn/Pad1D_cn.rst
Outdated
- **value** (float32) - 以 ``'constant'`` 模式填充区域时填充的值。默认值为 0.0。 | ||
- **data_format** (str) - 指定输入的 format,可为 ``'NCL'`` 或者 ``'NLC'``,默认值为 ``'NCL'``。 | ||
- **value** (float,可选) - 以 ``'constant'`` 模式填充区域时填充的值。默认值为 0.0。 | ||
- **data_format** (str,可选) - 指定输入的 format,可为 ``'NCL'`` 或者 ``'NLC'``,默认值为 ``'NCL'``。 |
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.
format 翻译一下吧,参考其他的大多翻译成了数据格式
docs/api/paddle/nn/Pad1D_cn.rst
Outdated
否则填充的格式为[pad_left, pad_right]。 | ||
- **mode** (str) - padding 的四种模式,分别为 ``'constant'``, ``'reflect'``, ``'replicate'`` 和 ``'circular'``。 | ||
- **mode** (str,可选) - padding 的四种模式,分别为 ``'constant'``, ``'reflect'``, ``'replicate'`` 和 ``'circular'``。 | ||
``'constant'`` 表示填充常数 ``value`` ; ``'reflect'`` 表示填充以输入边界值为轴的映射;``'replicate'`` 表示 | ||
填充输入边界值;``'circular'`` 为循环填充输入。默认值为 ``'constant'``。 |
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.
这里也不应该折行,个人建议使用列表的方式来展示各个可选值的意义:
- **mode** (str,可选) - padding 的模式,可选值为 ``'constant'``, ``'reflect'``, ``'replicate'`` 和 ``'circular'``。默认值为 ``'constant'``。
- ``'constant'`` 表示填充常数 ``value``;
- ``'reflect'`` 表示填充以输入边界值为轴的映射;
- ``'replicate'`` 表示填充输入边界值;
- ``'circular'`` 为循环填充输入。
docs/api/paddle/nn/Pad1D_cn.rst
Outdated
- ``'constant'`` 表示填充常数 ``value``; | ||
- ``'reflect'`` 表示填充以输入边界值为轴的映射; | ||
- ``'replicate'`` 表示填充输入边界值; | ||
- ``'circular'`` 为循环填充输入。 |
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.
docs/api/paddle/nn/Pad1D_cn.rst
Outdated
- **value** (float32) - 以 ``'constant'`` 模式填充区域时填充的值。默认值为 0.0。 | ||
- **data_format** (str) - 指定输入的 format,可为 ``'NCL'`` 或者 ``'NLC'``,默认值为 ``'NCL'``。 | ||
- **padding** (Tensor|list[int]|int) - 填充大小。如果是 int,则在所有待填充边界使用相同的填充,否则填充的格式为[pad_left, pad_right]。 | ||
- **mode** (str,可选) - padding 的四种模式,分别为 ``'constant'``, ``'reflect'``, ``'replicate'`` 和 ``'circular'``。 |
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.
这里各个可选值在中文用、
隔开
另外,默认值没啦 😂,记得加回来。英文那边也也按这种列表的形式同步修改下吧~
则会根据 ``pad`` 和 ``value`` 对 ``x`` 从前面的维度向后依次补齐;否则:1。当输入维度为 3 时,pad 的格式为[pad_left, pad_right]; | ||
2. 当输入维度为 4 时,pad 的格式为[pad_left, pad_right, pad_top, pad_bottom]; | ||
3. 当输入维度为 5 时,pad 的格式为[pad_left, pad_right, pad_top, pad_bottom, pad_front, pad_back]。 | ||
- **x** (Tensor) - Tensor,format 可以为 ``'NCL'``, ``'NLC'``, ``'NCHW'``, ``'NHWC'``, ``'NCDHW'``或 ``'NDHWC'``,默认值为 ``'NCHW'``,数据类型支持 float16, float32, float64, int32, int64。 |
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.
这里同样要用、
隔开
- **pad** (Tensor|list[int]|tuple[int]) - 填充大小。如果 ``mode`` 为 ``'constant'``,并且 ``pad`` 的长度为 ``x`` 维度的 2 倍时,则会根据 ``pad`` 和 ``value`` 对 ``x`` 从前面的维度向后依次补齐;否则: | ||
- 1. 当输入维度为 3 时,pad 的格式为[pad_left, pad_right]; | ||
- 2. 当输入维度为 4 时,pad 的格式为[pad_left, pad_right, pad_top, pad_bottom]; | ||
- 3. 当输入维度为 5 时,pad 的格式为[pad_left, pad_right, pad_top, pad_bottom, pad_front, pad_back]。 |
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.
这里要么直接用有序列表 1.2.3.
,要么直接用无序列表 -
,不要两者混在一起,另外这里缩进也少一个空格(rst 貌似 3 缩进),可利用上面那个在线预览调整下
- ``'reflect'`` 表示填充以 ``x`` 边界值为轴的映射; | ||
- ``'replicate'`` 表示填充 ``x`` 边界值; | ||
- ``'circular'`` 为循环填充 ``x``。具体结果可见以下示例。默认值为 ``'constant'``。 | ||
- **value** (float32,可选) - 以 ``'constant'`` 模式填充区域时填充的值。默认值为:math:`0.0`。 |
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.
这里的 float
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.
这里的 float32
貌似还没有改成 float
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.
辛苦再稍微修改一下~
- ``'constant'`` 表示填充常数 ``value``; | ||
- ``'reflect'`` 表示填充以 ``x`` 边界值为轴的映射; | ||
- ``'replicate'`` 表示填充 ``x`` 边界值; | ||
- ``'circular'`` 为循环填充 ``x``。具体结果可见以下示例。 |
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.
这里列表还是有问题,需要空行:
这里它将紧贴着的渲染成了 <dl>
,可参考 https://zh-sphinx-doc.readthedocs.io/en/latest/rest.html#id18 ,这里有说「列表可以嵌套,但是需跟父列表使用空行分隔」,所以可能需要写成这样:
- **mode** (str,可选) - padding 的四种模式,分别为 ``'constant'``、 ``'reflect'``、 ``'replicate'`` 和 ``'circular'``,默认值为 ``'constant'``。
- ``'constant'`` 表示填充常数 ``value``;
- ``'reflect'`` 表示填充以 ``x`` 边界值为轴的映射;
- ``'replicate'`` 表示填充 ``x`` 边界值;
- ``'circular'`` 为循环填充 ``x``。具体结果可见以下示例。
- **value** (float32,可选) - 以 ``'constant'`` 模式填充区域时填充的值。默认值为:math:`0.0`。
非常抱歉并不是很熟悉嵌套列表,所以之前有点误导
- ``'reflect'`` 表示填充以 ``x`` 边界值为轴的映射; | ||
- ``'replicate'`` 表示填充 ``x`` 边界值; | ||
- ``'circular'`` 为循环填充 ``x``。具体结果可见以下示例。默认值为 ``'constant'``。 | ||
- **value** (float32,可选) - 以 ``'constant'`` 模式填充区域时填充的值。默认值为:math:`0.0`。 |
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.
这里的 float32
貌似还没有改成 float
- ``'replicate'`` 表示填充 ``x`` 边界值; | ||
- ``'circular'`` 为循环填充 ``x``。具体结果可见以下示例。 | ||
- **value** (float32,可选) - 以 ``'constant'`` 模式填充区域时填充的值。默认值为:math:`0.0`。 | ||
- **data_format** (str,可选) - 指定 ``x`` 的数据格式,可为 ``'NCL'``, ``'NLC'``, ``'NCHW'``, ``'NHWC'``, ``'NCDHW'``或 ``'NDHWC'``,默认值为 ``'NCHW'``。 |
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.
这里的可选值也应该是用、
分割,上面也有很多处,需要都改掉。
另外,中文标点符号和中英文之间不需要加空格,所以、
两侧不应该有空格。
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.
应该没有其他问题了
英文目测没问题,预览的话好像看不了
- **value** (float32,可选) - 以 ``'constant'`` 模式填充区域时填充的值。默认值为 0.0。 | ||
- **data_format** (str,可选) - 指定 ``x`` 的 format,可为 ``'NCL'``, ``'NLC'``, ``'NCHW'``, ``'NHWC'``, ``'NCDHW'`` | ||
或 ``'NDHWC'``,默认值为 ``'NCHW'``。 | ||
- **x** (Tensor) - Tensor,format 可以为 ``'NCL'``、``'NLC'``、``'NCHW'``、``'NHWC'``、``'NCDHW'`` 或 ``'NDHWC'``,默认值为 ``'NCHW'``,数据类型支持float16、float32、float64、int32、int64。 |
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.
这个文件代码风格检查没过,这里 float16 前少一个空格,用 pre-commit 格式化下吧
- 当输入维度为 4 时,pad 的格式为[pad_left, pad_right, pad_top, pad_bottom]; | ||
- 当输入维度为 5 时,pad 的格式为[pad_left, pad_right, pad_top, pad_bottom, pad_front, pad_back]。 | ||
|
||
- **mode** (str,可选) - padding 的四种模式,分别为 ``'constant'``、``'reflect'``、``'replicate'`` 和``'circular'``, |
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.
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.
done!
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.
LGTM,中文源码和预览应该可以了,英文源码目测是 ok 的,但预览貌似没有构建上不敢确定。
@Ligoml 我觉得没啥问题啦,交给你啦~~~ |
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.
good job!
LGTM
PADDLEPADDLE_PR: PaddlePaddle/Paddle#45068
PADDLEPADDLE_PR=45068