Skip to content

Fix PaddleDocs function pad #7300

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

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion docs/api/paddle/nn/functional/pad_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ pad
.. note::
1. 记 ``x`` 的维数为 N (以下延用)。 ``pad`` 的长度:

1.1. 当 ``mode`` 为 ``'constant'`` 时, ``pad`` 的长度可以是任意小于等于 2*N 的偶数。
1.1. 当 ``mode`` 为 ``'constant'`` 时, ``pad`` 的长度可以是任意小于等于 2*N 的偶数。若输入奇数长度的 ``pad`` ,会自动在末尾补零至偶数长度。例如:``pad=[0, 0, 0, 0, 2]`` 会被扩展为 ``[0, 0, 0, 0, 2, 0]`` ,表示最后一个维度前填充 2 个值,后填充 0 个值。此行为可能导致预期外的填充结果,因此 **不建议使用奇数长度的 pad** 。

1.2. 当 ``mode`` 为 ``'reflect'``、 ``'replicate'`` 或 ``'circular'`` 时, ``pad`` 的长度必须为 2*(N-2)。

2. ``pad`` 的顺序:支持右对齐(从 ``x`` 的最后一维开始)。特别地,当 ``mode`` 为 ``'constant'`` ,且 ``pad`` 是长度为 2N 的列表时,pad 的顺序可以通过 ``pad_from_left_axis`` 参数来控制,如果 ``pad_from_left_axis`` 是 True,pad 的顺序则是左对齐;如果 ``pad_from_left_axis`` 是 False,pad 的顺序则是右对齐。
Expand Down