code: def to_tensor(data):
      import numbers
      from collections import defaultdict
  
      data_dict = defaultdict(list)
      to_tensor_idxs = []
  
      for idx, v in enumerate(data):
          if isinstance(v, (np.ndarray, paddle.Tensor, numbers.Number)):
              if idx not in to_tensor_idxs:
                  to_tensor_idxs.append(idx)
          data_dict[idx].append(v)
      for idx in to_tensor_idxs:
          data_dict[idx] = paddle.to_tensor(data_dict[idx])
      return list(data_dict.values())
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  import os
  import sys
  import cv2
  import json
  import paddle
  from ppocr.data import create_operators, transform
  from ppocr.modeling.architectures import build_model
  from ppocr.postprocess import build_post_process
  from ppocr.utils.save_load import load_model
  from ppocr.utils.visual import draw_ser_results
  from ppocr.utils.utility import get_image_file_list, load_vqa_bio_label_maps
  import tools.program
label_desc: Use image node_id 1 for calling a global function with example usage: to_tensor(data) and returns: list