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
apply_gumbel_noise_kernel
def apply_gumbel_noise_kernel[dtype: DType, OutputLayoutType: TensorLayout, InputLayoutType: TensorLayout, num_sms: Int, num_threads: Int](output: TileTensor[dtype, OutputLayoutType, MutAnyOrigin], input: TileTensor[dtype, InputLayoutType, ImmutAnyOrigin], temperature: Optional[Pointer[Float32, ImmutAnyOrigin]], seed: Optional[Pointer[UInt64, ImmutAnyOrigin]])
Adds Gumbel(0,1) noise to logits for sampling via the Gumbel-max trick.
Parameters:
- βdtype (
DType): Data type of the input and output logit buffers. - βOutputLayoutType (
TensorLayout): Layout of the output tensor. - βInputLayoutType (
TensorLayout): Layout of the input tensor. - βnum_sms (
Int): Number of streaming multiprocessors to launch with. - βnum_threads (
Int): Number of threads per block.
Args:
- βoutput (
TileTensor[dtype, OutputLayoutType, MutAnyOrigin]): Output tensor of noised logits. - βinput (
TileTensor[dtype, InputLayoutType, ImmutAnyOrigin]): Input tensor of logits. - βtemperature (
Optional[Pointer[Float32, ImmutAnyOrigin]]): Optional per-token temperature scaling. - βseed (
Optional[Pointer[UInt64, ImmutAnyOrigin]]): Optional per-token random seed.