Memory estimation inconsistent with actual GPU memory utilization
See original GitHub issueDescribe the bug Memory estimation inconsistent with actual GPU memory utilization
To Reproduce
- I am using a simple UNet with 2 layers (same as here).
- The input size is (1, 1, 4096, 3328)
Expected behavior
When forwarding an image of size (1, 1, 4096, 3328) in testing mode, i.e., model.eval() on, the reported GPU memory is approximatly 15GB:

However, torchinfo.summary reports 50GB, even though eval is passed as argument:
summary(model, input_size=(1, 1, 4096, 3328), mode='eval', device=device)

Issue Analytics
- State:
- Created a year ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Memory estimates for recursive models are inconsistent with ...
Memory estimates are inconsistent with actual GPU usage for recursive models. To Reproduce Example code: import torch from torch.nn import ...
Read more >7 Tested Methods to Fix Your GPU Memory is Full Message
1. Adjust paging file settings for the game drive · 2. Update the graphics driver · 3. Use the 3GB switch · 4....
Read more >Task Manager Has Shown VRAM USED not ALLOCATED ...
The 'Dedicated GPU memory usage' tab on task manager (CTRL+SHIFT+ESC) is pulling from VidMm, which is the OS information on usage.
Read more >Why is gpu device used not consistent with log info?
Yes, its normal that if a GPU has all of its memory utilized (however that came about), and then your process tries to...
Read more >Monitoring GPU utilization for Deep Learning - Paperspace Blog
An out of memory means the GPU has run out of resources that it can allocate for the assigned task. This error often...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Actually, gradient is not calculated in any of the modes since
torch.no_gradis used for both train and eval mode, seeforward_passfunction in torchinfo.py. I also checked. Gpu memory usage remains the same when changing the mode.@devrimcavusoglu I don’t have enough GPU memory for the model. That’s why I was trying to estimate it