torch.xpu.empty_cache
- torch.xpu.empty_cache()[source]
Release all unoccupied cached memory currently held by the caching allocator so that those can be used in other XPU application.
Note
empty_cache()
doesn’t increase the amount of XPU memory available for PyTorch. However, it may help reduce fragmentation of XPU memory in certain cases.