code: def get_index(
      x, image_width, target_width, coordinate_transformation_mode
  ):
      """get and round the nearest index for nearest_neighbor"""
      in_x = get_inx(
          x, image_width, target_width, coordinate_transformation_mode
      )
      if coordinate_transformation_mode == "align_corners":
          # round prefer ceil
          out = int(math.floor(in_x + 0.5))
      else:
          out = int(math.floor(in_x))
      out = max(min(out, image_width - 1), 0)
      return out
  
file_path: tvm/python/tvm/topi/testing/resize_python.py
imports: import math
  import numpy
  from tvm.topi.utils import nchw_pack_layout
label_desc: Use image node_id 2 for calling a global function with example usage: get_index(x, image_width, target_width, coordinate_transformation_mode) and returns: out