Python package
legacy
Legacy graph-based neural network API.
Note
The legacy API provides graph-based layer implementations for building neural networks. This API was the primary interface prior to MAX 26.1 and remains available for backward compatibility.
Using the Legacy API:
from max.nn.legacy import Module, Linear, LayerNorm
from max.nn.legacy.attention import AttentionWithRopeModules
attention: Attention mechanisms for sequence modeling.clamp: Value clamping utilities for tensor operations.comm: Communication primitives for distributed training.conv: Convolutional layers for spatial processing.conv_transpose: Transposed convolution for upsampling.embedding: Embedding layers with vocabulary support.float8_config: Configuration for FP8 quantization.hooks: Extension hooks for layer customization.kernels: Custom kernel implementations.kv_cache: Key-value cache for efficient generation.layer: Base classes for building graph-based layers.linear: Linear transformation layers with optional parallelism.lora: Low-Rank Adaptation for efficient fine-tuning.moe: Mixture of Experts layer implementations.norm: Normalization layers for training stability.rotary_embedding: Rotary position embeddings for sequences.sampling: Sampling strategies for generation.sequential: Container for sequential layer composition.transformer: Transformer building blocks and layers.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!