code: def run_all_class_nms(
      boxes,
      sorted_scores,
      sorted_indices,
      valid_count,
      max_output_size_per_class,
      iou_threshold,
      nms_loop,
      return_scores=False,
  ):
      """The core all class NMS routine
  
      Parameters
      ----------
      boxes : tvm.te.Tensor
          3-D tensor with shape (batch_size, num_boxes, 4)
  
      sorted_scores: tvm.te.Tensor
          2-D tensor with shape (batch_size * num_classes, num_boxes)
          One of the outputs from argsort
  
      sorted_indices: tvm.te.Tensor
          2-D tensor with shape (batch_size * num_classes, num_boxes)
          The other output from argsort
  
      valid_count: tvm.te.Tensor
          1-D tensor with shape (batch_size * num_classes,), representing
          the number of boxes whose score is above score_threshold, per batch and class
  
      max_output_boxes_per_class : int or tvm.te.Tensor, optional
          The maxinum number of output selected boxes per class
  
      iou_threshold : float or tvm.te.Tensor, optionaIl
          IoU test threshold
  
      nms_loop : function
          A core NMS loop, see its usage in vision/nms.py and cuda/nms.py
  
      return_scores : bool, optional
          Whether or not to return selected scores, needed by the tensorflow output format.
  
      Returns
      -------
      out : a list of tvm.te.Tensor
          The output is three tensors, the first and second are indices and scores of size
          (batch_size * num_class, num_boxes), and the third is a tensor
          num_selected_boxes of shape (batch_size * num_class,) representing the total number of
          selected boxes per batch and class. If return_scores is False, the second output is
          None.
      """
      batch, num_boxes, _ = boxes.shape
      batch_class = sorted_scores.shape[0]
      num_class = batch_class // batch
  
      if return_scores is False:
          selected_indices, num_detections = te.extern(
              [(batch_class, num_boxes), (1, batch_class)],
              [boxes, sorted_scores, sorted_indices, valid_count],
              lambda ins, outs: _all_class_nms_ir(
                  ins[0],  # boxes
                  ins[1],  # sorted_scores
                  ins[2],  # sorted_indices
                  ins[3],  # valid_count
                  batch_class,
                  num_class,
                  num_boxes,
                  iou_threshold,
                  max_output_size_per_class,
                  outs[0],  # box_indices
                  None,  # scores
                  outs[1],  # num_selected_boxes
                  nms_loop,
              ),
              dtype=["int32", "int32"],
              name="all_class_nms",
              tag="all_class_nms",
          )
          return selected_indices, None, num_detections
  
      return te.extern(
          [
              (batch_class, num_boxes),
              (batch_class, num_boxes),
              (1, batch_class),
          ],
          [boxes, sorted_scores, sorted_indices, valid_count],
          lambda ins, outs: _all_class_nms_ir(
              ins[0],  # boxes
              ins[1],  # sorted_scores
              ins[2],  # sorted_indices
              ins[3],  # valid_count
              batch_class,
              num_class,
              num_boxes,
              iou_threshold,
              max_output_size_per_class,
              outs[0],  # box_indices
              outs[1],  # selected scores
              outs[2],  # num_selected_boxes
              nms_loop,
          ),
          dtype=["int32", "float32", "int32"],
          name="all_class_nms",
          tag="all_class_nms",
      )
  
file_path: tvm/python/tvm/topi/vision/nms_util.py
imports: import tvm
  from tvm import te
label_desc: Use image node_id 7 for calling a global function with example usage: run_all_class_nms(boxes, sorted_scores, sorted_indices, valid_count, max_output_size_per_class, iou_threshold, nms_loop, return_scores) and returns: te, selected_indices,  None,  num_detections