code: def resize2D_PIL(
      input, size, roi_start, roi_end, dtype, channel_first, resample
  ):
      if channel_first:
          input = input.transpose([1, 2, 0])
      size = list(reversed(size.astype(np.int32).tolist()))
      roi_start = reversed(roi_start.tolist())
      roi_end = reversed(roi_end.tolist())
  
      box = list(roi_start) + list(roi_end)
  
      has_overshoot = resample in (LANCZOS, BICUBIC)
      if has_overshoot:
          # compress dynamic range to allow for overshoot
          input = (64 + input * 0.5).round().astype(np.uint8)
  
      out = PIL.Image.fromarray(input).resize(
          size, box=box, resample=resample
      )
      out = np.array(out)
  
      if channel_first:
          out = out.transpose([2, 0, 1])
      if has_overshoot:
          out = (out.astype(np.float32) - 64) * 2.0
      if dtype == np.uint8:
          out = out.round().clip(0, 255).astype(np.uint8)
      elif dtype == types.FLOAT:
          out = out.astype(np.float32)
      return out
  
imports: import cv2
  import functools
  import math
  import numpy
  import nvidia.dali
  import nvidia.dali.fn
  import nvidia.dali.types
  import os.path
  from nvidia.dali import Pipeline, pipeline_def
  from nvidia.dali.data_node import DataNode
  from test_utils import check_batch, get_dali_extra_path, as_array
  import PIL.Image
label_desc: Use image node_id 2 for calling a global function with example usage: resize2D_PIL(input, size, roi_start, roi_end, dtype, channel_first, resample) and returns: out