Detectron2 Non-Maximum Suppression

Has anyone done this before? I can’t seem to find any code online that streamlines this functionality, even the nms functions within detectron2 don’t exactly make it all that simple. You still have to calculate the IoU, but can only do it for two objects at a time?

Was wondering if maybe I have read this incorrectly or if someone could push me in the right direction.