当前位置:网站首页>Pytorch training CPU usage continues to grow (Bug)
Pytorch training CPU usage continues to grow (Bug)
2022-07-02 23:00:00 【zyr_ freedom】
CPU Memory continues to increase during training , rise , Use gc.collect() Invalid
1. Use
@profile You can see cpu Occupancy
2. Check for mistakes
python Content and tensor Whether there is a direct exchange of content, focus on checking , Focus on the accumulated places , This will lead to memory leakage
Example
such as acc += list(correctness) To the left of the equal sign is python Native list,correctness yes torch.FloatTensor
Switch to acc += list(np.array(correctness.cpu()))
reason :list And tensor There is a memory leak problem in mutual transfer , If you need to switch , Should be tensor from cuda-->cpu-->numpy.array
Example
total_loss +=loss1------->total_loss +=loss1.item() (.item() Is to get the element value in an element tensor )
Forget when reasoning torch.no_grad() Cause gradient accumulation
边栏推荐
- Hanging mirror security won four global infosec awards on rsac2022
- Go 4 modes Singleton
- 【板栗糖GIS】arcmap—如何批量修改注记要素的字体,颜色,大小等
- [chestnut sugar GIS] ArcMap - how to batch modify the font, color, size, etc. of annotation elements
- Golang's learning route
- 2016. 增量元素之间的最大差值
- 世界环境日 | 周大福用心服务推动减碳环保
- easyclick,ec权朗网络验证源码
- Go condition variable
- go 多线程数据搜索
猜你喜欢

海思3559万能平台搭建:在截获的YUV图像上旋转操作

牛客网:最大子矩阵
![[leetcode] reverse the word III in the string [557]](/img/72/d3e46a820796a48b458cd2d0a18f8f.png)
[leetcode] reverse the word III in the string [557]

WebRTC音视频采集和播放示例及MediaStream媒体流解析

Uniapp wechat login returns user name and Avatar
![[chestnut sugar GIS] ArcScene - how to make elevation map with height](/img/91/f3df0a7633263c6264cb5c27eb149f.png)
[chestnut sugar GIS] ArcScene - how to make elevation map with height

地方经销商玩转社区团购模式,百万运营分享
![The kth largest element in the [leetcode] array [215]](/img/72/d3e46a820796a48b458cd2d0a18f8f.png)
The kth largest element in the [leetcode] array [215]
![Jielizhi, production line assembly link [chapter]](/img/0d/102596ad13aafd9c6133509d9064dd.png)
Jielizhi, production line assembly link [chapter]

Qt QScrollArea
随机推荐
Jerry's built-in short press and long press, no matter how long it is, it is a short press [chapter]
Generics and reflection, this is enough
How does Jerry test the wrong touch rate of keys [chapter]
[leetcode] reverse the word III in the string [557]
创新实力再获认可!腾讯安全MSS获2022年度云原生安全守护先锋
PMP project integration management
`Usage of ${}`
【板栗糖GIS】arcmap—如何批量修改注记要素的字体,颜色,大小等
Motivation du Protocole de chiffrement avancé AES
Learning records of data analysis (II) -- simple use of response surface method and design expert
Odoo13 build a hospital HRP environment (detailed steps)
中国信通院、清华大学、腾讯安全,云原生安全产学研用强强联合!
Comprehensively analyze the logic of the shared purchase business model? How sharing purchase empowers Enterprises
[NPUCTF2020]ezlogin xPATH注入
[Solved] Splunk: Cannot get username when all users are selected“
容器化技术在嵌入式领域的应用
mysql重置密码,忘记密码,重置root密码,重置mysql密码
Go 4 modes Singleton
Webrtc audio and video capture and playback examples and mediastream media stream analysis
P7072 [CSP-J2020] 直播获奖