[Feature]: Batched top-k selection operator
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 1
- Forks
- 10
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 1
Description
Add a batched operator that returns the k largest elements' indices and values along a configurable axis, optionally sorted and gated by a score threshold. This replaces IoU-NMS in end-to-end detectors, which select a bounded top-k of candidates directly.
Use cases
- NMS-free detection: select top-K candidates by confidence (YOLO26/YOLOv10 one-to-one head; DETR top-k over queries).
- Classification: top-5 predictions.
Requirements
- Input scores tensor + configurable axis,
K, and optional score threshold (entries below threshold excluded / padded). - Output top-k indices and values per batch (
[B, N]→[B, K]); sorted-descending option. - Define behavior when valid entries < K (padding / count output).
- Dtypes: fp32 inputs; integer index output.
- GPU and CPU paths, following the existing operator/kernel-wrapper pattern.
Acceptance
- Correct top-k (indices + values) vs a CPU golden model across shapes, K values, and the threshold path.
- Deterministic tie/ordering behavior, documented.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by surveying the existing operator/kernel-wrapper pattern and its CPU and GPU implementations. Validate the operator against a CPU golden model across shapes, K values, threshold cases, and ties; done means indices and values, padding or counts for fewer valid entries, deterministic ordering, and behavior are documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-vision
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100