IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /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. /get-started.md).

Mojo struct

Struct_topk_topp_masked_probs

struct Struct_topk_topp_masked_probs

Registers the sampler.topk_topp_masked_probs graph op.

Writes each row's top-k/top-p masked renormalized softmax, without sampling. Speculative decoding verification reads the target's masked probabilities and builds its rejection residual straight from this tensor, so nothing is sorted and no distribution is rebuilt in-graph.

Implemented traitsโ€‹

AnyType, Deinitable, Movable

Methodsโ€‹

executeโ€‹

static def execute[dtype: DType, target: StringSpan[ImmStaticOrigin], _trace_name: StringSpan[ImmStaticOrigin]](probs: ManagedTensorSlice[IOSpec[_, _].Output, static_spec=probs.static_spec], K: ManagedTensorSlice[IOSpec[_, _].Input, static_spec=K.static_spec], temperature: ManagedTensorSlice[IOSpec[_, _].Input, static_spec=temperature.static_spec], top_p: ManagedTensorSlice[IOSpec[_, _].Input, static_spec=top_p.static_spec], input: ManagedTensorSlice[IOSpec[_, _].Input, static_spec=input.static_spec], ctx: DeviceContext)