code: def get_cuda_or_mps_device_if_available() -> torch.device:
      """Checks OS and platform and runs get_cuda_device_if_available or get_mps_device_if_available.
  
      Returns:
          torch.device
      """
      if sys.platform == "darwin" and platform.machine() == "arm64":
          return get_mps_device_if_available()
      else:
          return get_cuda_device_if_available()
  
imports: import platform
  import sys
  import warnings
  from functools import wraps
  from inspect import isclass, isfunction
  from typing import TYPE_CHECKING, Any, Callable, List, Optional, Tuple, Union, overload
  import torch
  from torch.linalg import inv_ex
  from kornia.core import Tensor
  from kornia.utils._compat import torch_version_ge
label_desc: Use image node_id 3 for calling a global function with example usage: get_cuda_or_mps_device_if_available() and returns: get_mps_device_if_available, get_cuda_device_if_available