code: def pre_nms(params, cls_outputs, box_outputs, topk=True):
      """Detection post processing before nms.
  
      It takes the multi-level class and box predictions from network, merge them
      into unified tensors, and compute boxes, scores, and classes.
  
      Args:
        params: a dict of parameters.
        cls_outputs: a list of tensors for classes, each tensor denotes a level of
          logits with shape [N, H, W, num_class * num_anchors].
        box_outputs: a list of tensors for boxes, each tensor ddenotes a level of
          boxes with shape [N, H, W, 4 * num_anchors].
        topk: if True, select topk before nms (mainly to speed up nms).
  
      Returns:
        A tuple of (boxes, scores, classes).
      """
      # get boxes by apply bounding box regression to anchors.
      eval_anchors = anchors.Anchors(
          params["min_level"],
          params["max_level"],
          params["num_scales"],
          params["aspect_ratios"],
          params["anchor_scale"],
          params["image_size"],
      )
  
      cls_outputs, box_outputs = merge_class_box_level_outputs(
          params, cls_outputs, box_outputs
      )
  
      if topk:
          # select topK purely based on scores before NMS, in order to speed up nms.
          cls_outputs, box_outputs, classes, indices = topk_class_boxes(
              params, cls_outputs, box_outputs
          )
          anchor_boxes = tf.gather(eval_anchors.boxes, indices)
      else:
          anchor_boxes = eval_anchors.boxes
          classes = None
  
      boxes = anchors.decode_box_outputs(box_outputs, anchor_boxes)
      # convert logits to scores.
      scores = tf.math.sigmoid(cls_outputs)
      return boxes, scores, classes
  
file_path: DALI/docs/examples/use_cases/tensorflow/efficientdet/model/utils/postprocess.py
imports: from typing import List, Tuple
  from absl import logging
  import tensorflow
  from pipeline import anchors
label_desc: Use image node_id 5 for calling a global function with example usage: pre_nms(params, cls_outputs, box_outputs, topk) and returns: boxes,  scores,  classes