kevinlu4588's picture
Training gradient ascent models and sanity checking car erasure
e225ed6
raw
history blame
227 Bytes
import torch
def clear_cuda_cache():
if torch.cuda.is_available():
torch.cuda.empty_cache()
print("CUDA cache cleared.")
else:
print("CUDA is not available on this device.")
clear_cuda_cache()