For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).
Mojo function
non_max_suppression_gpu
def non_max_suppression_gpu[dtype: DType, BoxesLayout: TensorLayout, ScoresLayout: TensorLayout, OutputLayout: TensorLayout, BoxesEngine: TensorEngine = DefaultEngine, ScoresEngine: TensorEngine = DefaultEngine, OutputEngine: TensorEngine = DefaultEngine](boxes: TileTensor[dtype, BoxesLayout, ImmutAnyOrigin, Engine=BoxesEngine], scores: TileTensor[dtype, ScoresLayout, ImmutAnyOrigin, Engine=ScoresEngine], output: TileTensor[.int64, OutputLayout, MutAnyOrigin, Engine=OutputEngine], max_output_boxes_per_class: Int, iou_threshold: Float32, score_threshold: Float32, ctx: DeviceContextBase)
Runs NMS on the GPU: pairs in batch-major order, greedy state in one CTA.
The output's first dimension must be the host-sized selection count; rows pack sequentially in pair order, matching the CPU kernel.
Parameters:
- dtype (
DType): The data type for box coordinates and scores. - BoxesLayout (
TensorLayout): Layout type of the boxes tensor. - ScoresLayout (
TensorLayout): Layout type of the scores tensor. - OutputLayout (
TensorLayout): Layout type of the output tensor. - BoxesEngine (
TensorEngine): Engine type of the boxes tensor. - ScoresEngine (
TensorEngine): Engine type of the scores tensor. - OutputEngine (
TensorEngine): Engine type of the output tensor.
Args:
- boxes (
TileTensor[dtype, BoxesLayout, ImmutAnyOrigin, Engine=BoxesEngine]): Rank-3 tensor of bounding boxes with shape(batch, num_boxes, 4)where each box is[y1, x1, y2, x2]. - scores (
TileTensor[dtype, ScoresLayout, ImmutAnyOrigin, Engine=ScoresEngine]): Rank-3 tensor of scores with shape(batch, num_classes, num_boxes). - output (
TileTensor[.int64, OutputLayout, MutAnyOrigin, Engine=OutputEngine]): Rank-2 output tensor of selected rows[b, c, box]. - 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 for a box to be considered. - ctx (
DeviceContextBase): Device context used to enqueue GPU work.
Raises:
Error: If num_boxes exceeds the shared-memory candidate
budget; that shape runs on the host path instead.