当前位置:网站首页>【torch】|torch. nn. utils. clip_ grad_ norm_
【torch】|torch. nn. utils. clip_ grad_ norm_
2022-07-06 05:18:00 【rrr2】

The greater the gradient ,total_norm The bigger the value is. , Leading to clip_coef The smaller the value of , Eventually, it will also lead to the more severe clipping of the gradient , Very reasonable.
norm_type Take... No matter how much , about total_norm The impact is not too great (1 and 2 The gap is a little larger ), So you can take the default value directly 2
norm_type The bigger it is ,total_norm The smaller it is ( The conclusions observed in the experiment , Math is not good , It will not prove that , So this article is not necessarily right )
...
loss = crit(...)
optimizer.zero_grad()
loss.backward()
torch.nn.utils.clip_grad_norm_(parameters=model.parameters(), max_norm=10, norm_type=2)
optimizer.step()
...
clip_coef The smaller it is , The more severe the cutting of gradient , namely , The more you reduce the value of the gradient
max_norm The smaller it is ,clip_coef The smaller it is , therefore ,max_norm The bigger it is , The softer the solution of gradient explosion ,max_norm The smaller it is , The harder to solve the gradient explosion .max_norm You can take decimals
ref
https://blog.csdn.net/Mikeyboi/article/details/119522689
边栏推荐
- GAMES202-WebGL中shader的編譯和連接(了解向)
- Postman pre script - global variables and environment variables
- Drive development - the first helloddk
- Select knowledge points of structure
- [effective Objective-C] - memory management
- Compilation and connection of shader in games202 webgl (learn from)
- Using stopwatch to count code time
- [untitled]
- MySQL if and ifnull use
- JS quick start (II)
猜你喜欢

The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower

指針經典筆試題

JS quick start (II)

In 2022, we must enter the big factory as soon as possible

从0到1建设智能灰度数据体系:以vivo游戏中心为例
![[untitled]](/img/7e/d0724193f2f2c8681a68bda9e08289.jpg)
[untitled]

Principle and performance analysis of lepton lossless compression

Imperial cms7.5 imitation "D9 download station" software application download website source code

Ora-01779: the column corresponding to the non key value saving table cannot be modified

Codeforces Round #804 (Div. 2) Editorial(A-B)
随机推荐
JS quick start (II)
Tetris
Fiddler installed the certificate, or prompted that the certificate is invalid
[leetcode] 18. Sum of four numbers
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
Biscuits (examination version)
初识CDN
Pickle and savez_ Compressed compressed volume comparison
[noip2009 popularization group] score line delimitation
SQLite queries the maximum value and returns the whole row of data
浅谈镜头滤镜的类型及作用
What are the advantages of the industry private network over the public network? What specific requirements can be met?
Excel转换为Lua的配置文件
Select knowledge points of structure
Huawei od computer test question 2
RT thread analysis - object container implementation and function
[leetcode16] the sum of the nearest three numbers (double pointer)
Fluent implements a loadingbutton with loading animation
Rce code and Command Execution Vulnerability
Figure database ongdb release v-1.0.3