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 struct
FilteredTopk
struct FilteredTopk
The indexer top-k with the filtered select (filtered_topk_block_split).
Implemented traits
AnyType,
Deinitable,
IndexerTopk,
Movable
Methods
select
static def select[in_dtype: DType, RB: RowBound](ctx: DeviceContext, scores: ImmPointer[Scalar[in_dtype], ImmutAnyOrigin], out_idxs: MutPointer[Int32, MutAnyOrigin], n: Int, k: Int, rows: Int, row_bounds: RB)
Writes the top-k columns of each row of scores to out_idxs.
Parameters:
Args:
- ctx (
DeviceContext): Device context. - scores (
ImmPointer[Scalar[in_dtype], ImmutAnyOrigin]): Row-major scores,[rows, n]. - out_idxs (
MutPointer[Int32, MutAnyOrigin]): Row-major output,[rows, k]. - n (
Int): Score columns per row, the row stride. - k (
Int): Columns selected per row. - rows (
Int): Score rows. - row_bounds (
RB): Per-row live column counts and output sinks.