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

change index gradient_clip_cn #5138

Merged
merged 1 commit into from
Aug 16, 2022
Merged
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
10 changes: 5 additions & 5 deletions docs/guides/advanced/gradient_clip_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
二、Paddle 梯度裁剪使用方法
---------------------------

1. 设定范围值裁剪
2.1 设定范围值裁剪
###################

设定范围值裁剪:将参数的梯度限定在一个范围内,如果超出这个范围,则进行裁剪。
Expand Down Expand Up @@ -68,8 +68,8 @@

linear = paddle.nn.Linear(10, 10,bias_attr=paddle.ParamAttr(need_clip=False))

2. 通过 L2 范数裁剪
###################
2.2 通过 L2 范数裁剪
######################

通过 L2 范数裁剪:梯度作为一个多维 Tensor,计算其 L2 范数,如果超过最大值则按比例进行裁剪,否则不裁剪。

Expand Down Expand Up @@ -117,8 +117,8 @@

linear = paddle.nn.Linear(10, 10, weight_attr=paddle.ParamAttr(need_clip=False))

3. 通过全局 L2 范数裁剪
#######################
2.3 通过全局 L2 范数裁剪
##########################

将优化器中全部参数的梯度组成向量,对该向量求解 L2 范数,如果超过最大值则按比例进行裁剪,否则不裁剪。

Expand Down