code: def recursive_to_device(
      value: Union[Tuple, List, "torch.Tensor"], device: str
  ):
      if isinstance(value, tuple):
          value = list(value)
          for i, val in enumerate(value):
              value[i] = recursive_to_device(val, device)
          value = tuple(value)
      elif isinstance(value, list):
          for i, val in enumerate(value):
              value[i] = recursive_to_device(val, device)
      elif isinstance(value, torch.Tensor):
          value = value.to(device)
  
      return value
  
imports: import copy
  from typing import TYPE_CHECKING, Dict, List, Optional, Tuple, Union
  import torch
  from packaging import version
  from transformers.models.speecht5.modeling_speecht5 import SpeechT5HifiGan
  from transformers.utils import is_tf_available, is_torch_available
  from ...utils import DIFFUSERS_MINIMUM_VERSION, ORT_QUANTIZE_MINIMUM_VERSION, check_if_diffusers_greater, is_diffusers_available, logging
  from ...utils.import_utils import _diffusers_version
  from ..tasks import TasksManager
  from .constants import ONNX_DECODER_NAME, ONNX_DECODER_WITH_PAST_NAME, ONNX_ENCODER_NAME
label_desc: Use image node_id 12 for calling a global function with example usage: recursive_to_device(value, device) and returns: value