code: def move_to(obj, device=None):
      """
  
      Parameters
      ----------
      obj
          Nested torch object
      device
          The target device
  
      Returns
      -------
      new_obj
          The objects that have been moved to device.
      """
      if th.is_tensor(obj):
          return obj.to(device)
      elif isinstance(obj, dict):
          res = {}
          for k, v in obj.items():
              res[k] = move_to(v, device)
          return res
      elif isinstance(obj, (list, tuple)):
          res = []
          for v in obj:
              res.append(move_to(v, device))
          if isinstance(obj, tuple):
              res = tuple(res)
          return res
      else:
          raise TypeError("Invalid type for move_to")
  
imports: import torch
  import numpy
label_desc: Use image node_id 4 for calling a global function with example usage: move_to(obj, device) and returns: obj, res, res