code: def send_to_device(
      tensor, device, non_blocking=False, skip_keys=None
  ):
      """
      Recursively sends the elements in a nested list/tuple/dictionary of tensors to a given device.
  
      Args:
          tensor (nested list/tuple/dictionary of `torch.Tensor`):
              The data to send to a given device.
          device (`torch.device`):
              The device to send the data to.
  
      Returns:
          The same data structure as `tensor` with all tensors sent to the proper device.
      """
      if isinstance(tensor, (tuple, list)):
          return honor_type(
              tensor,
              (
                  send_to_device(
                      t,
                      device,
                      non_blocking=non_blocking,
                      skip_keys=skip_keys,
                  )
                  for t in tensor
              ),
          )
      elif isinstance(tensor, Mapping):
          if isinstance(skip_keys, str):
              skip_keys = [skip_keys]
          elif skip_keys is None:
              skip_keys = []
          return type(tensor)(
              {
                  k: t
                  if k in skip_keys
                  else send_to_device(
                      t,
                      device,
                      non_blocking=non_blocking,
                      skip_keys=skip_keys,
                  )
                  for k, t in tensor.items()
              }
          )
      elif hasattr(tensor, "to"):
          # `torch.Tensor.to(<int num>)` is not supported by `torch_npu` (see this [issue](https://github.com/Ascend/pytorch/issues/16)).
          if is_npu_available() and isinstance(device, int):
              device = f"npu:{device}"
          try:
              return tensor.to(device, non_blocking=non_blocking)
          except (
              TypeError
          ):  # .to() doesn't accept non_blocking as kwarg
              return tensor.to(device)
      else:
          return tensor
  
imports: import pickle
  import warnings
  from functools import update_wrapper, wraps
  from typing import Any, Mapping
  import torch
  from ..state import PartialState
  from .constants import TORCH_DISTRIBUTED_OPERATION_TYPES
  from .dataclasses import DistributedType, TensorInformation
  from .imports import is_npu_available, is_torch_distributed_available, is_torch_version, is_tpu_available
label_desc: Use image node_id 7 for calling a global function with example usage: send_to_device(tensor, device, non_blocking, skip_keys) and returns: honor_type, type, tensor, tensor, tensor