code: def imresize(img, scale, antialiasing=True):
      # Now the scale should be the same for H and W
      # input: img: pytorch tensor, CHW or HW [0,1]
      # output: CHW or HW [0,1] w/o round
      need_squeeze = True if img.dim() == 2 else False
      if need_squeeze:
          img.unsqueeze_(0)
      in_C, in_H, in_W = img.size()
      out_C, out_H, out_W = (
          in_C,
          math.ceil(in_H * scale),
          math.ceil(in_W * scale),
      )
      kernel_width = 4
      kernel = "cubic"
  
      # Return the desired dimension order for performing the resize.  The
      # strategy is to perform the resize first along the dimension with the
      # smallest scale factor.
      # Now we do not support this.
  
      # get weights and indices
      (
          weights_H,
          indices_H,
          sym_len_Hs,
          sym_len_He,
      ) = calculate_weights_indices(
          in_H, out_H, scale, kernel, kernel_width, antialiasing
      )
      (
          weights_W,
          indices_W,
          sym_len_Ws,
          sym_len_We,
      ) = calculate_weights_indices(
          in_W, out_W, scale, kernel, kernel_width, antialiasing
      )
      # process H dimension
      # symmetric copying
      img_aug = torch.FloatTensor(
          in_C, in_H + sym_len_Hs + sym_len_He, in_W
      )
      img_aug.narrow(1, sym_len_Hs, in_H).copy_(img)
  
      sym_patch = img[:, :sym_len_Hs, :]
      inv_idx = torch.arange(sym_patch.size(1) - 1, -1, -1).long()
      sym_patch_inv = sym_patch.index_select(1, inv_idx)
      img_aug.narrow(1, 0, sym_len_Hs).copy_(sym_patch_inv)
  
      sym_patch = img[:, -sym_len_He:, :]
      inv_idx = torch.arange(sym_patch.size(1) - 1, -1, -1).long()
      sym_patch_inv = sym_patch.index_select(1, inv_idx)
      img_aug.narrow(1, sym_len_Hs + in_H, sym_len_He).copy_(
          sym_patch_inv
      )
  
      out_1 = torch.FloatTensor(in_C, out_H, in_W)
      kernel_width = weights_H.size(1)
      for i in range(out_H):
          idx = int(indices_H[i][0])
          for j in range(out_C):
              out_1[j, i, :] = (
                  img_aug[j, idx : idx + kernel_width, :]
                  .transpose(0, 1)
                  .mv(weights_H[i])
              )
  
      # process W dimension
      # symmetric copying
      out_1_aug = torch.FloatTensor(
          in_C, out_H, in_W + sym_len_Ws + sym_len_We
      )
      out_1_aug.narrow(2, sym_len_Ws, in_W).copy_(out_1)
  
      sym_patch = out_1[:, :, :sym_len_Ws]
      inv_idx = torch.arange(sym_patch.size(2) - 1, -1, -1).long()
      sym_patch_inv = sym_patch.index_select(2, inv_idx)
      out_1_aug.narrow(2, 0, sym_len_Ws).copy_(sym_patch_inv)
  
      sym_patch = out_1[:, :, -sym_len_We:]
      inv_idx = torch.arange(sym_patch.size(2) - 1, -1, -1).long()
      sym_patch_inv = sym_patch.index_select(2, inv_idx)
      out_1_aug.narrow(2, sym_len_Ws + in_W, sym_len_We).copy_(
          sym_patch_inv
      )
  
      out_2 = torch.FloatTensor(in_C, out_H, out_W)
      kernel_width = weights_W.size(1)
      for i in range(out_W):
          idx = int(indices_W[i][0])
          for j in range(out_C):
              out_2[j, :, i] = out_1_aug[
                  j, :, idx : idx + kernel_width
              ].mv(weights_W[i])
      if need_squeeze:
          out_2.squeeze_()
      return out_2
  
imports: import math
  import os
  import random
  from datetime import datetime
  import cv2
  import numpy
  import torch
  from torchvision.utils import make_grid
label_desc: Use image node_id 48 for calling a global function with example usage: imresize(img, scale, antialiasing) and returns: out_2