Error: empty_cache not found in torch.cuda

my code is :
import torch
import numpy as np
a_2GB = np.ones((214, 214))
a_2GB_torch = torch.from_numpy(a_2GB)
a_2GB_torch_gpu = a_2GB_torch.cuda()
a_2GB_torch_gpu = a_2GB_torch_gpu.cpu()
torch.cuda.empty_cache()

but i am getting error :
AttributeError: module ‘torch.cuda’ has no attribute ‘empty_cache’

Hi,

Which version of pytorch are you using?
Double check that you use the documentation corresponding to your pytorch version.
empty_cache() was added in pytorch 0.3.0 if I recall correctly.

i got … mine is 0.2.0_4.
as always , very very thanks

FYI, you can access the doc for 0.2.0 here :slight_smile:

1 Like