code: def to_tensor(np_img: ndarray) -> torch.Tensor:
      net = np_img.transpose([2, 0, 1])[None]
      net = torch.from_numpy(net)
      return net
  
imports: import torch
  import numpy
  from abc import abstractmethod
  from enum import Enum
  from numpy import ndarray
  from typing import Any
  from typing import List
  from typing import Tuple
  from typing import Union
  from typing import Optional
  from typing import NamedTuple
  from PIL.Image import Image
  from cftool.cv import to_uint8
  from cftool.cv import read_image
  from ....misc.toolkit import download_model
label_desc: Use image node_id 5 for calling a global function with example usage: to_tensor(np_img) and returns: net