Free the CUDA memory of cupy.
Source code in darts-utils/src/darts_utils/cuda.py
| def free_cupy():
"""Free the CUDA memory of cupy."""
try:
import cupy as cp
except ImportError:
cp = None
if cp is not None:
gc.collect()
cp.get_default_memory_pool().free_all_blocks()
cp.get_default_pinned_memory_pool().free_all_blocks()
|