code: def to_tensor(data):
      """Convert objects of various python types to :obj:`torch.Tensor`.
  
      Supported types are: :class:`numpy.ndarray`, :class:`torch.Tensor`,
      :class:`Sequence`, :class:`int` and :class:`float`.
  
      Args:
          data (torch.Tensor | numpy.ndarray | Sequence | int | float): Data to
              be converted.
      """
  
      if isinstance(data, torch.Tensor):
          return data
      elif isinstance(data, np.ndarray):
          return torch.from_numpy(data)
      elif isinstance(data, Sequence) and not mmcv.is_str(data):
          return torch.tensor(data)
      elif isinstance(data, int):
          return torch.LongTensor([data])
      elif isinstance(data, float):
          return torch.FloatTensor([data])
      else:
          raise TypeError(
              f"type {type(data)} cannot be converted to tensor."
          )
  
imports: from collections.abc import Sequence
  import annotator.uniformer.mmcv
  import numpy
  import torch
  from annotator.uniformer.mmcv.parallel import DataContainer
  from ..builder import PIPELINES
label_desc: Use image node_id 1 for calling a global function with example usage: to_tensor(data) and returns: data, torch, torch, torch, torch