I guess you were looking for this topic:
  
    
    
    PyTorch doesn't free GPU's memory of it gets aborted due to out-of-memory error 
  
  
    I noticed that 99% of the GPU RAM is still being used after and no process is listed by nvidia-smi after PyTorch aborts with an 
RuntimeError: cuda runtime error (2) : out of memory at /opt/conda/conda-bld/pytorch_1518244421288/work/torch/lib/THC/generic/THCStorage.see you:58

One could run sudo nvidia-smi --gpu-reset -i 0 as a remedy, however,  it would be nice if PyTorch could free the memory after such a “crash” – not sure if this is only a problem in my particular case, so I wanted to ask if…