IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /max/get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /max/get-started.md).

Mojo function

topk_softmax_sample_kernel

def topk_softmax_sample_kernel[block_size: Int, vec_size: Int, dtype: DType, out_idx_type: DType, LogitsLayoutType: TensorLayout, logits_origin: ImmutOrigin, SampledLayoutType: TensorLayout, sampled_origin: MutOrigin](logits: TileTensor[dtype, LogitsLayoutType, logits_origin], sampled_indices: TileTensor[out_idx_type, SampledLayoutType, sampled_origin], top_k_arr: Optional[UnsafePointer[Scalar[out_idx_type], MutUntrackedOrigin]], top_k_val: Int, temperature_val: Float32, temperature: Optional[UnsafePointer[Float32, MutUntrackedOrigin]], seed_val: UInt64, seed: Optional[UnsafePointer[UInt64, MutUntrackedOrigin]], d: Int)