当前位置:网站首页>【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
边栏推荐
- MySQL if and ifnull use
- Golang -- TCP implements concurrency (server and client)
- Select knowledge points of structure
- Simple understanding of interpreters and compilers
- 集合详解之 Collection + 面试题
- Can the feelings of Xi'an version of "Coca Cola" and Bingfeng beverage rush for IPO continue?
- flutter 实现一个有加载动画的按钮(loadingButton)
- yolov5 tensorrt加速
- Extension of graph theory
- Talking about the type and function of lens filter
猜你喜欢
趋势前沿 | 达摩院语音 AI 最新技术大全
[leetcode16] the sum of the nearest three numbers (double pointer)
图数据库ONgDB Release v-1.0.3
[effective Objective-C] - memory management
用StopWatch 统计代码耗时
Zynq learning notes (3) - partial reconfiguration
Codeforces Round #804 (Div. 2) Editorial(A-B)
图论的扩展
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)
随机推荐
Vulhub vulnerability recurrence 68_ ThinkPHP
Review of double pointer problems
Summary of redis basic knowledge points
Zynq learning notes (3) - partial reconfiguration
Postman test report
Oracle deletes duplicate data, leaving only one
Codeforces Round #804 (Div. 2) Editorial(A-B)
Postman Association
Some common skills on unity inspector are generally used for editor extension or others
Fuzzy -- basic application method of AFL
[untitled]
Golang -- TCP implements concurrency (server and client)
Ora-01779: the column corresponding to the non key value saving table cannot be modified
Set detailed map + interview questions
Extension of graph theory
Three. JS learning - light and shadow (understanding)
[effective Objective-C] - memory management
Excel转换为Lua的配置文件
Unity gets the width and height of Sprite
A little knowledge of CPU, disk and memory