code: def to_tensor(self, x):
      if isinstance(x, np.ndarray):
          if x.ndim == 2:
              x = x[:, :, None]
      img = (
          paddle.to_tensor(x.transpose([2, 0, 1])).astype("float32")
          / 255
      )
      return img
  
imports: import paddle
  import paddle.nn.functional
  import numpy
  from inference.transforms import AddHorizontalFlip, SigmoidForPred, LimitLongestSide
  from .ops import DistMaps, ScaleLayer, BatchImageNormalize
label_desc: Use image node_id 2 for calling the BasePredictor obj's underlying member method code with example usage: obj.to_tensor(x) and returns: img