Mojo function
non_max_suppression_shape_func
non_max_suppression_shape_func[dtype: DType](boxes: LayoutTensor[dtype, layout, origin, address_space=address_space, element_layout=element_layout, layout_int_type=layout_int_type, linear_idx_type=linear_idx_type, masked=masked, alignment=alignment], scores: LayoutTensor[dtype, layout, origin, address_space=address_space, element_layout=element_layout, layout_int_type=layout_int_type, linear_idx_type=linear_idx_type, masked=masked, alignment=alignment], max_output_boxes_per_class: Int, iou_threshold: Float32, score_threshold: Float32) -> IndexList[2]
Compute the output shape for NMS without allocating the output buffer.
This function performs a dry-run of NMS to determine how many boxes will be selected, allowing proper output buffer allocation. Can be removed once the graph compiler supports value semantic kernels that allocate their own output.
Args:
- boxes (
LayoutTensor
): Rank-3 tensor of bounding boxes with shape (batch, num_boxes, 4). - scores (
LayoutTensor
): Rank-3 tensor of scores with shape (batch, num_classes, num_boxes). - max_output_boxes_per_class (
Int
): Maximum number of boxes to select per class. - iou_threshold (
Float32
): IoU threshold for suppression. - score_threshold (
Float32
): Minimum score threshold.
Returns:
IndexList
: A 2-element IndexList specifying the output shape (num_selected_boxes, 3).
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!