Skip to main content

Python package

legacy

Legacy graph-based neural network API.

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 AttentionWithRope

Modules

  • 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?