code: def calculate_overlap(out_tensor, box_a_idx, box_b_idx):
      """Calculate overlap of two boxes."""
      a_l, a_t, a_r, a_b = _get_boundaries(out_tensor, box_a_idx)
      b_l, b_t, b_r, b_b = _get_boundaries(out_tensor, box_b_idx)
  
      # Overlapping width and height
      w = tvm.te.max(0.0, tvm.te.min(a_r, b_r) - tvm.te.max(a_l, b_l))
      h = tvm.te.max(0.0, tvm.te.min(a_b, b_b) - tvm.te.max(a_t, b_t))
  
      # Overlapping area
      area = h * w
  
      # total area of the figure formed by box a and box b
      # except for overlapping area
      u = (a_r - a_l) * (a_b - a_t) + (b_r - b_l) * (b_b - b_t) - area
      return tvm.tir.Select(u <= 0.0, 0.0, area / u)
  
file_path: tvm/python/tvm/topi/vision/nms_util.py
imports: import tvm
  from tvm import te
label_desc: Use image node_id 2 for calling a global function with example usage: calculate_overlap(out_tensor, box_a_idx, box_b_idx) and returns: tvm