当前位置:网站首页>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
边栏推荐
- Graphic view frame
- PMP project integration management
- How can I use knockout's $parent/$root pseudovariables from inside a . computed() observable?
- [leetcode] reverse the word III in the string [557]
- Golang面试整理 三 简历如何书写
- Storage unit conversion
- MySQL reset password, forget password, reset root password, reset MySQL password
- [羊城杯2020]easyphp
- [Solved] Splunk: Cannot get username when all users are selected“
- 【板栗糖GIS】arcmap—如何批量修改注记要素的字体,颜色,大小等
猜你喜欢
随机推荐
boot actuator - prometheus使用
[LeetCode] 多数元素【169】
剑指 Offer II 099. 最小路径之和-双百代码
WebRTC音视频采集和播放示例及MediaStream媒体流解析
[leetcode] reverse string [344]
Xiaopeng P7 had an accident and the airbag did not pop up. Is this normal?
[chestnut sugar GIS] ArcScene - how to make elevation map with height
[LeetCode] 存在重复元素【217】
Go 4 modes Singleton
归并排序详解及应用
Jerry's charge unplugged, unable to touch the boot [chapter]
kubernetes 使用主机名将 pod 分配在指定节点上
Golang interview finishing three resumes how to write
Dahua cloud native load balancing article - the passenger flow of small restaurants has increased
1px pixel compatibility of mobile terminal, 1px border
`Usage of ${}`
Qt QSplitter拆分器
How can I use knockout's $parent/$root pseudovariables from inside a . computed() observable?
海思3559万能平台搭建:在截获的YUV图像上画框
[Solved] Splunk: Cannot get username when all users are selected“
![[羊城杯2020]easyphp](/img/12/da28f738e50e625b0a66a94af3703d.png)







![[Solved] Splunk: Cannot get username when all users are selected“](/img/13/1e824c8005701e21fc5b4e73308d53.png)