Specific environment:
Untubu:16.04
pytorch :1.5.0
CUDA:10.0
When I was running code using pytorch, I encountered the following error:
RuntimeError: CUDA error:out of memory
I tried to look at many methods on the Internet, but there was no solution. Then I thought that I had run a similar code before, and there seemed to be such a line of code:
Then I try to add the following two lines of code to my code:
import torch.backends.cudnn as cudnn
cudnn.benchmark = True
Fortunately, my code is working properly. Of course, this may be one of the n methods. Everyone is likely to modify their own code according to the specific situation of their own code.