code: def ml_nms(boxlist, nms_thresh, max_proposals=-1, fixed_size=False):
      """
      Performs non-maximum suppression on a boxlist, with scores specified
      in a boxlist field via score_field.
  
      Args:
          boxlist (data.structures.Boxes):
          nms_thresh (float): the score threshold for nms
          max_proposals (int): if > 0, then only the top max_proposals are kept
              after non-maximum suppression
          fixed_size (bool): force output to be static shape
      """
      if nms_thresh <= 0:
          return boxlist
      boxes = boxlist.pred_boxes.tensor
      scores = boxlist.scores
      labels = boxlist.pred_classes
      keep = batched_nms(boxes, scores, labels, nms_thresh)
      # keep = nms(boxes, scores, nms_thresh)
      if max_proposals > 0:
          keep = keep[:max_proposals]
      if fixed_size:
          boxlist._keep = keep
          # the following code block is one way to perform a static nms op
          # scores = -scores
          # scores[keep] = -scores[keep]
          # result_mask = torch.zeros(scores.size()).to(scores.device)
          # result_mask[keep] = 1
          # scores = torch.where(result_mask == 1, scores, result_mask)
          boxlist.scores = scores
      else:
          boxlist = boxlist[keep]
      return boxlist
  
file_path: gluon-cv/gluoncv/torch/nn/nms.py
imports: import numpy
  import torch
  from torchvision.ops import boxes
  from torchvision.ops import nms
label_desc: Use image node_id 2 for calling a global function with example usage: ml_nms(boxlist, nms_thresh, max_proposals, fixed_size) and returns: boxlist, boxlist