code: def _to_recursive(batched: Any, device: torch.device) -> Any:
      if isinstance(batched, torch.Tensor):
          return batched.to(device)
      elif isinstance(batched, list):
          return [x.to(device) for x in batched]
      elif isinstance(batched, tuple):
          return tuple(x.to(device) for x in batched)
      else:
          raise TypeError("Unsupported type of data")
  
imports: from typing import Any, Callable, Sequence
  import torch
  from torch.utils.data._utils.collate import default_collate
label_desc: Use image node_id 1 for calling a global function with example usage: _to_recursive(batched, device) and returns: batched, unknown, tuple