GPU memory cannot be freed

Hi, I want to free the GPU after the calculation of the neural network model. I tried del the model, imort gc and use gc.collect(), it just cannot work. is there any way to free the GPU memory?

the GPU memory is probably freed. But nvidia-smi reporting of GPU memory will be incorrect because pytorch uses it’s own caching memory allocator for GPU.