I found that when I del the tensor, the GPU still has a small amount of memory occupation.
The codes are below:
import torch
t = torch.zeros([1024, 1024, 1024, 2], device=‘cuda:0’)
del t
torch.cuda.empty_cache()
The GPU still has about 700M usage
|==================+=============+==================|
| 0 GeForce RTX 208… Off | 00000000:05:00.0 Off | N/A |
| 33% 49C P8 29W / 250W | 717MiB / 11016MiB | 0% Default |
±------------------------------±---------------------±--------------------------------+