Non_max_suppression and the argument of classes

my question will be about the process of non-max suppression and its implementation by the method tf.image.non_max_suppression().
As far as I understood, we need to perform the maximum overlap filtering,i.e. iou-filtering, for the remaining boxes of different classes independently after the score-filtering process and the iou filtering goes as follows: Find the max scores for each classes and ignore the boxes with iou above the iou_threshold.
However it seems to me that the classes are not considered in the function tf.image.non_max_suppression() since it doesnot take the classes as argument but boxes and scores. So my question how does this function know or perform the class-wise elimination of boxes with high iou?

Lots of prior discussion of this topic. Here is one…

Think crisply about what the set of boxes output by the YOLO CNN represents, what non-max suppression accomplishes without considering classes, and what the inclusion of classes would change. What is the benefit of including class at that step? What is the cost? Let us know?