PyTorch 2 · Performance

Free cached GPU memory

Release unused cached memory back to the GPU.

torch.cuda.empty_cache()

Official PyTorch 2 documentation

More performance commands

All performance commands · PyTorch 2 cheatsheet

Was this page helpful?