Code
import torch

a = torch.randn(1000000, 1000, device=0)

#
# current gpu usage = 4383M
#

b = a.cpu()

#
# current gpu usage is still = 4383M
#

I’d like to free gpu memory(a) after convert the tensor to cpu.
What I’ve tried:
import gc
del a
gc.collect()

But it still occupies 4383M of gpu.
How can I do this?