Unable to clear CUDA cache

Hi,

I am trying to clear the CUDA cache using torch.cuda.empty_cache() but it is unable to clear it.

Following are the code and the error:

Thanks!

empty_cache will only release the unused and cached memory.
If the parameters and activations need more memory, you will run into an OOM error nevertheless.
You could try to lower the batch size or alternatively use torch.utils.checkpoint to trade compute for memory.