code: def garbage_collection_cuda() -> None:
      """Garbage collection Torch (CUDA) memory."""
      gc.collect()
      try:
          # This is the last thing that should cause an OOM error, but seemingly it can.
          torch.cuda.empty_cache()
      except RuntimeError as exception:
          if not is_oom_error(exception):
              # Only handle OOM errors
              raise
  
file_path: pytorch-lightning/src/lightning/pytorch/utilities/memory.py
imports: import gc
  from typing import Any
  import torch
  from lightning_utilities.core.apply_func import apply_to_collection
  from torch import Tensor
label_desc: Use image node_id 6 for calling a global function with example usage: garbage_collection_cuda() without return types