code: def _run(  # type: ignore
      self,
      boxes,
      scores,
      max_output_boxes_per_class,
      iou_threshold,
      score_threshold,
      center_point_box,
  ):
      center_point_box = center_point_box or self.center_point_box  # type: ignore
  
      pc = PrepareContext()
      self.prepare_compute(
          pc,
          boxes,
          scores,
          max_output_boxes_per_class,
          iou_threshold,
          score_threshold,
      )
  
      (
          max_output_boxes_per_class,
          iou_threshold,
          score_threshold,
      ) = self.get_thresholds_from_inputs(pc, 0, 0, 0)
  
      if max_output_boxes_per_class.size == 0:
          return (np.empty((0,), dtype=np.int64),)
  
      boxes_data = pc.boxes_data_
      scores_data = pc.scores_data_
  
      selected_indices = []
      # std::vector<BoxInfo> selected_boxes_inside_class;
      # selected_boxes_inside_class.reserve(
      #    std::min<size_t>(static_cast<size_t>(max_output_boxes_per_class), pc.num_boxes_));
  
      for batch_index in range(pc.num_batches_):
          for class_index in range(pc.num_classes_):
              box_score_offset = (batch_index, class_index)
              batch_boxes = boxes_data[batch_index]  # type: ignore
              # std::vector<BoxInfo> candidate_boxes;
              # candidate_boxes.reserve(pc.num_boxes_);
  
              # Filter by score_threshold_
              candidate_boxes = []
              class_scores = scores_data[box_score_offset]  # type: ignore
              if pc.score_threshold_ is not None:
                  for box_index in range(pc.num_boxes_):
                      if class_scores[box_index] > score_threshold:
                          candidate_boxes.append(
                              BoxInfo(
                                  class_scores[box_index], box_index
                              )
                          )
              else:
                  for box_index in range(pc.num_boxes_):
                      candidate_boxes.append(
                          BoxInfo(class_scores[box_index], box_index)
                      )
  
              sorted_boxes = sorted(candidate_boxes)
  
              selected_boxes_inside_class = []  # type: ignore
              # Get the next box with top score, filter by iou_threshold.
              while (
                  len(sorted_boxes) > 0
                  and len(selected_boxes_inside_class)
                  < max_output_boxes_per_class
              ):
                  next_top_score = sorted_boxes[-1]
  
                  selected = True
                  # Check with existing selected boxes for this class,
                  # suppress if exceed the IOU (Intersection Over Union) threshold.
                  for selected_index in selected_boxes_inside_class:
                      if suppress_by_iou(
                          batch_boxes,
                          next_top_score.idx_,
                          selected_index.idx_,
                          center_point_box,
                          iou_threshold,
                      ):
                          selected = False
                          break
  
                  if selected:
                      selected_boxes_inside_class.append(next_top_score)
                      selected_indices.append(
                          SelectedIndex(
                              batch_index,
                              class_index,
                              next_top_score.idx_,
                          )
                      )
  
                  sorted_boxes.pop()
  
      result = np.empty((len(selected_indices), 3), dtype=np.int64)
      for i in range(result.shape[0]):
          result[i, 0] = selected_indices[i].batch_index_
          result[i, 1] = selected_indices[i].class_index_
          result[i, 2] = selected_indices[i].box_index_
      return (result,)
  
file_path: onnx/onnx/reference/ops/op_non_max_suppression.py
imports: import dataclasses
  from typing import Optional, Tuple
  import numpy
  from onnx.reference.op_run import OpRun
label_desc: Use image node_id 3 for calling the NonMaxSuppression obj's underlying member method code with example usage: obj._run(boxes, scores, max_output_boxes_per_class, iou_threshold, score_threshold, center_point_box) and returns: result, np