pyTorch runs out of memory

I have a simple CNN and i’m getting an error which says, that I try to allocate 3 GB of memory, and that I need more RAM. I have tried to decrease the size of the input image, but it also throws an error when it tries to “allocate 0 GB of memory”.

My CPU has 8 GB of ram so I cannot see how 3 GB can be an issue - I don’t have additional programs open.

Could you post a snippet of the code so that we can help?