code: def convert_tensor(input_, device=None, non_blocking=False):
      
      def _func(tensor):
          return tensor.to(device=device, non_blocking=non_blocking) if device else tensor
  
      return apply_to_tensor(input_, _func)
docs: Move tensors to relevant device.