code: def _fetch_score_ir(data, score, axis):
      """
      Fetch score from data.
      This routine is required for dynamic shape nms.
      """
      batch_size = data.shape[0]
      num_anchors = data.shape[1]
      elem_length = data.shape[2]
  
      ib = tvm.tir.ir_builder.create()
  
      data = ib.buffer_ptr(data)
      score = ib.buffer_ptr(score)
      with ib.if_scope(num_anchors > 0):
          max_threads = int(
              tvm.target.Target.current(
                  allow_none=False
              ).max_num_threads
          )
          nthread_tx = max_threads
          nthread_bx = batch_size * num_anchors // max_threads + 1
          tx = te.thread_axis("threadIdx.x")
          bx = te.thread_axis("blockIdx.x")
          ib.scope_attr(tx, "thread_extent", nthread_tx)
          ib.scope_attr(bx, "thread_extent", nthread_bx)
  
          tid = bx * max_threads + tx
          with ib.if_scope(tid < batch_size * num_anchors):
              score[tid] = data[tid * elem_length + axis]
  
      return ib.get()
  
imports: import tvm
  from tvm import te
  from tvm.contrib import nvcc
  from tvm.contrib.thrust import can_use_thrust, can_use_rocthrust
  from tvm.ir import register_intrin_lowering
  from tvm.tir import if_then_else
  from .sort import argsort, argsort_thrust
  from .scan import exclusive_scan
  from ..utils import ceil_div
  from ..math import cast
  from ..transform import reshape
  from ..vision.nms_util import calculate_overlap, binary_search, collect_selected_indices, collect_selected_indices_and_scores, run_all_class_nms
label_desc: Use image node_id 9 for calling a global function with example usage: _fetch_score_ir(data, score, axis) and returns: ib