code: def tensor2single3(img):
      img = img.data.squeeze().float().cpu().numpy()
      if img.ndim == 3:
          img = np.transpose(img, (1, 2, 0))
      elif img.ndim == 2:
          img = np.expand_dims(img, axis=2)
      return img
  
imports: import os
  import math
  import random
  import numpy
  import torch
  import cv2
  from torchvision.utils import make_grid
  from datetime import datetime
label_desc: Use image node_id 27 for calling a global function with example usage: tensor2single3(img) and returns: img