How to swap data between cpu and gpu

If you want to release the GPU memory, use torch.cuda.empty_cache().
I found a topic about how to release a tensor here, but I’m not sure it will work…