code: def _shutdown_torch(destroy_process_group=False):
      from ray.air._internal.torch_utils import get_device
  
      devices = get_device()
      if not isinstance(devices, list):
          devices = [devices]
      if destroy_process_group:
          dist.destroy_process_group()
      if torch.cuda.is_available():
          for device in devices:
              with torch.cuda.device(device):
                  torch.cuda.empty_cache()
  
imports: import logging
  import os
  from dataclasses import dataclass
  from datetime import timedelta
  from typing import Optional
  import torch
  import torch.distributed
  import ray
  from ray.train._internal.utils import get_address_and_port
  from ray.train._internal.worker_group import WorkerGroup
  from ray.train.backend import Backend, BackendConfig
  from ray.train.constants import DEFAULT_NCCL_SOCKET_IFNAME
  from ray.util import PublicAPI
label_desc: Use image node_id 3 for calling a global function with example usage: _shutdown_torch(destroy_process_group) without return types