code: def to_float_tensor(img):
      """
      Converts a PIL.Image (RGB) or numpy.ndarray (H x W x C) in the range
      [0, 255] to a torch.FloatTensor of shape (C x H x W).
      Args:
          img: np.ndarray
      Returns:
          torch.tensor
      """
  
      img = img.transpose((2, 0, 1))
      img = torch.from_numpy(np.array(img)).float()
      if img.max() > 1:
          img /= 255
  
      return img
  
imports: import os
  import numpy
  from sahi.utils.import_utils import is_available
label_desc: Use image node_id 2 for calling a global function with example usage: to_float_tensor(img) and returns: img