code: def KORNIA_CHECK_SAME_DEVICES(
      tensors: list[Tensor],
      msg: Optional[str] = None,
      raises: bool = True,
  ) -> bool:
      """Check whether a list provided tensors live in the same device.
  
      Args:
          x: a list of tensors.
          msg: message to show in the exception.
          raises: bool indicating whether an exception should be raised upon failure.
  
      Raises:
          Exception: if all the tensors are not in the same device and raises is True.
  
      Example:
          >>> x1 = torch.rand(2, 3, 3)
          >>> x2 = torch.rand(1, 3, 1)
          >>> KORNIA_CHECK_SAME_DEVICES([x1, x2], "Tensors not in the same device")
          True
      """
      KORNIA_CHECK(
          isinstance(tensors, list) and len(tensors) >= 1,
          "Expected a list with at least one element",
          raises,
      )
      if not all(tensors[0].device == x.device for x in tensors):
          if raises:
              raise Exception(
                  f"Not same device for tensors. Got: {[x.device for x in tensors]}.\n{msg}"
              )
          return False
      return True
  
imports: from __future__ import annotations
  from typing import Any, Optional, Sequence, TypeVar, cast
  from torch import float16, float32, float64
  from typing_extensions import TypeGuard
  from kornia.core import Tensor
label_desc: Use image node_id 8 for calling a global function with example usage: KORNIA_CHECK_SAME_DEVICES(tensors, msg, raises) and returns: True, False