code: def proposal(
      cls_prob,
      bbox_pred,
      im_info,
      scales,
      ratios,
      feature_stride,
      threshold,
      rpn_pre_nms_top_n,
      rpn_post_nms_top_n,
      rpn_min_size,
      iou_loss,
  ):
      """Proposal operator.
  
      Parameters
      ----------
      cls_prob : tvm.te.Tensor
          4-D with shape [batch, 2 * num_anchors, height, width]
  
      bbox_pred : tvm.te.Tensor
          4-D with shape [batch, 4 * num_anchors, height, width]
  
      im_info : tvm.te.Tensor
          2-D with shape [batch, 3]
  
      scales : list/tuple of float
          Scales of anchor windows.
  
      ratios : list/tuple of float
          Ratios of anchor windows.
  
      feature_stride : int
          The size of the receptive field each unit in the convolution layer of the rpn, for example
          the product of all stride's prior to this layer.
  
      threshold : float
          Non-maximum suppression threshold.
  
      rpn_pre_nms_top_n : int
          Number of top scoring boxes to apply NMS. -1 to use all boxes.
  
      rpn_post_nms_top_n : int
          Number of top scoring boxes to keep after applying NMS to RPN proposals.
  
      rpn_min_size : int
          Minimum height or width in proposal.
  
      iou_loss : bool
          Usage of IoU loss.
  
      Returns
      -------
      out : tvm.te.Tensor
          2-D tensor with shape [batch * rpn_post_nms_top_n, 5]. The last dimension is in format of
          [batch_index, w_start, h_start, w_end, h_end].
      """
      # pylint: disable=unused-argument
      batch, _, height, width = get_const_tuple(cls_prob.shape)
      num_anchors = len(scales) * len(ratios)
      num_bbox = height * width * num_anchors
      rpn_pre_nms_top_n = (
          min(rpn_pre_nms_top_n, num_bbox)
          if rpn_pre_nms_top_n > 0
          else num_bbox
      )
  
      bbox = te.extern(
          (batch, num_bbox, 5),
          [cls_prob, bbox_pred, im_info],
          lambda ins, outs: predict_bbox_ir(
              ins[0],
              ins[1],
              ins[2],
              outs[0],
              scales,
              ratios,
              feature_stride,
              rpn_min_size,
              iou_loss,
          ),
          dtype=bbox_pred.dtype,
      )
      score = te.compute(
          (batch, num_bbox),
          lambda b, i: bbox[b, i, 4],
          tag="bbox_score",
      )
      valid_count_shape = (1,)
      valid_count = te.compute(valid_count_shape, lambda i: num_bbox)
      sorted_index = argsort(
          score, valid_count=valid_count, axis=1, is_ascend=False
      )
      sorted_bbox = te.compute(
          (batch, rpn_pre_nms_top_n, 5),
          lambda b, i, j: bbox[b, sorted_index[b, i], j],
          tag="sorted_bbox",
      )
      nms_remove_mask = te.extern(
          (batch, rpn_pre_nms_top_n),
          [sorted_bbox],
          lambda ins, outs: nms_ir(ins[0], outs[0], threshold),
          dtype="bool",
      )
      nms_out = te.extern(
          (batch * rpn_post_nms_top_n, 5),
          [sorted_bbox, nms_remove_mask],
          lambda ins, outs: prepare_output_ir(ins[0], ins[1], outs[0]),
          dtype=sorted_bbox.dtype,
      )
      return nms_out
  
file_path: tvm/python/tvm/topi/vision/rcnn/proposal.py
imports: import math
  import tvm
  from tvm import te
  from ...utils import get_const_tuple, get_const_int
  from ...sort import argsort
label_desc: Use image node_id 8 for calling a global function with example usage: proposal(cls_prob, bbox_pred, im_info, scales, ratios, feature_stride, threshold, rpn_pre_nms_top_n, rpn_post_nms_top_n, rpn_min_size, iou_loss) and returns: nms_out