当前位置:网站首页>【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
边栏推荐
- Nacos TC setup of highly available Seata (02)
- Postman assertion
- Implementing fuzzy query with dataframe
- 树莓派3.5寸屏幕白屏显示连接
- Extension of graph theory
- What are the advantages of the industry private network over the public network? What specific requirements can be met?
- UCF(暑期团队赛二)
- Request (request object) and response (response object)
- Mongodb basic knowledge summary
- idea一键导包
猜你喜欢
Class inheritance in yyds dry inventory C
Zoom and pan image in Photoshop 2022
Three methods of Oracle two table Association update
Extension of graph theory
Excel转换为Lua的配置文件
Please wait while Jenkins is getting ready to work
Fiddler installed the certificate, or prompted that the certificate is invalid
Rce code and Command Execution Vulnerability
Safe mode on Windows
Idea one key guide package
随机推荐
RT thread analysis - object container implementation and function
Cuda11.1 online installation
Figure database ongdb release v-1.0.3
Huawei od computer test question 2
集合详解之 Map + 面试题
Flody的应用
[leetcode daily question] number of enclaves
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
Mysql高级篇学习总结9:创建索引、删除索引、降序索引、隐藏索引
Nestjs配置文件上传, 配置中间件以及管道的使用
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
Hometown 20 years later (primary school exercises)
Compilation and connection of shader in games202 webgl (learn from)
Force buckle 1189 Maximum number of "balloons"
[mask requirements of OSPF and Isis in multi access network]
UCF (2022 summer team competition I)
Oracle query table index, unique constraint, field
Ad20 is set with through-hole direct connection copper sheet, and the bonding pad is cross connected
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
Nacos - TC Construction of High available seata (02)