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 package
nn
Provides neural network operators for deep learning models.
Packagesβ
- β
attention: Multi-head attention (MHA) and multi-head latent attention (MLA) kernels. - β
conv: Convolution kernels (1D, 2D, 3D, transposed).
Modulesβ
- β
activations: The module contains implementations of activation functions. - β
arange: Implements thearangeoperation that fills a tensor with evenly-spaced values over a range. - β
arg_nonzero: Implementsarg_nonzero, which returns the indices of all nonzero elements in a tensor. - β
argmaxmin: Provides CPU and GPU implementations of the argmax and argmin reduction operations. - β
argmaxmin_gpu: Provides a GPU argmax/argmin kernel that wraps top-k with K=1 for inner-dimension reductions. - β
argsort: Provides CPU and GPU implementations of argsort that return indices permuting a tensor into sorted order. - β
bicubic: This module provides CPU and GPU implementations for bicubic interpolation. - β
broadcast: Implements numpy-style tensor broadcasting for CPU and GPU targets. - β
concat: Implements tensor concatenation along a specified axis for CPU and GPU targets. - β
cumsum: Implements the ONNX CumSum operator, computing prefix sums along a specified tensor axis. - β
fold: Implements the fold operation. - β
fused_qk_rope: Provides fused query/key rotary position embedding (RoPE) kernels with integrated KV-cache writes. - β
gather_scatter: Implements gather and scatter operations for CPU and GPU, including indexed reductions. - β
gemv_partial_norm: Fused matvec (M=1) + partial RMS norm on B200. - β
image: Provides pooling helpers and sliding-window shape utilities used by image-processing operations. - β
index_fp8: Implements tensor indexing and gather kernels with FP8 quantization support on Blackwell GPUs. - β
index_tensor: Implements numpy-style advanced tensor indexing (getitem and setitem) for CPU and GPU. - β
irfft: Inverse real FFT kernel using cuFFT. - β
kv_cache: - β
kv_cache_ragged: Implements KV-cache kernels for ragged (variable-length) sequences used in continuous batching. - β
learnable_2d_interp_pos_emb: Learnable 2D interpolated position embedding (Kimi K2.5 MoonViT3d). - β
moe: Implements Mixture-of-Experts (MoE) routing, token dispatch, and expert computation kernels. - β
nms: Implements non-maximum suppression (NMS) for object detection bounding-box filtering. - β
normalization: - β
pad: Implements tensor padding with constant or edge values for CPU and GPU. - β
pad_gpu: Implements GPU-specific tensor padding kernels with constant or edge-fill strategies. - β
pool: Provides average- and max-pooling kernels with configurable padding, dilation, and stride for CPU and GPU. - β
rand_normal: Generates tensors filled with values drawn from a normal (Gaussian) distribution for CPU and GPU. - β
rand_uniform: Generates tensors filled with values drawn from a uniform distribution for CPU and GPU. - β
randn: Provides a thin wrapper aroundrandnto fill aTileTensorwith standard-normal random values. - β
repeat_interleave: Implementsrepeat_interleave, which repeats each tensor element a specified number of times along an axis. - β
reshape: Implements the reshape operation that reinterprets a contiguous tensor's data under a new shape. - β
resize: Implements tensor resize (upsample/downsample) with nearest, bilinear, and other interpolation modes. - β
roi_align: Implements RoI Align, which extracts fixed-size feature maps from regions of interest using bilinear interpolation. - β
rope: - β
rope_split_store: Fused rope + split + KV store kernel. - β
sampling: Provides token-sampling utilities including logit-penalty application and repetition-penalty kernels. - β
shapes: Provides output-shape computation utilities for sliding-window operations such as pooling and convolution. - β
shard_and_stack: Implements shard-and-stack: shards a tensor across devices and stacks the shards into a higher-rank output. - β
slice: Implements the ONNX Slice operator, selecting sub-tensors along specified axes with start, stop, and step. - β
softmax: Provides numerically stable softmax kernels for CPU and GPU, including fused and online variants. - β
spatial_merge: Implements spatial merge, which compresses vision token grids by merging spatial blocks before attention. - β
split: Implements the tensor split operation, dividing a tensor into chunks along a specified axis. - β
tile: Implements the ONNX Tile operator, which replicates a tensor a specified number of times along each axis. - β
topk: Provides top-K selection kernels using warp- and block-level reductions for CPU and GPU. - β
topk_bitonic: Block-wide bitonic sort top-k for the MLA/MSA indexer. - β
topk_fi: Implements a float-integer packed top-K kernel that jointly tracks values and indices in a single register. - β
toppminp: Provides CPU implementations of top-p (nucleus) and min-p sampling for autoregressive token generation. - β
toppminp_gpu: Provides GPU implementations of top-p (nucleus) and min-p sampling for autoregressive token generation. - β
tpool_patch_merger: Implements the temporal-pool patch-merger kernel that reduces vision token sequences via average pooling.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!