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).

Python class

MXFP8Tensor

MXFP8Tensor​

class max.nn.common_layers.quant_tensor.MXFP8Tensor(*, weight, weight_scale, block_size=(1, 32))

source

Bases: _QuantizedWeight

MXFP8 (OCP microscaling) block-scaled quantized tensor.

One unpacked float8_e4m3fn value per byte, with one power-of-two float8_e8m0fnu scale per 32-element block along K. MX is pure block scaling: unlike NVFP4Tensor there is no per-tensor second level and no static activation scale.

Parameters:

  • weight (Tensor) – float8_e4m3fn weight data of shape [.., rows, cols].
  • weight_scale (Tensor) – Per-block float8_e8m0fnu scales of shape [.., ceil(rows / block_m), ceil(cols / block_k)], in checkpoint order; the matmuls interleave them for the kernel (see matmul()).
  • block_size (tuple[int, int]) – Per-block size as (block_m, block_k); (1, 32) for MXFP8.

block_size​

property block_size: tuple[int, int]

source

Quantization block shape as (rows, cols).

local_shards​

property local_shards: tuple[MXFP8Tensor, ...]

source

Per-device shards, pairing each weight shard with its scales.

mesh​

property mesh: DeviceMesh

source

Device mesh of the weight tensor.

scale_dtype​

scale_dtype: ClassVar[DType] = 73

source

Dtype of weight_scale.

shard()​

shard(axis, mesh)

source

Co-shard weight/weight_scale along axis onto mesh.

Parameters:

Return type:

MXFP8Tensor

storage_dtype​

storage_dtype: ClassVar[DType] = 75

source

Dtype of the stored weight.

to()​

to(target)

source

Returns a copy with weight and weight_scale on target.

Parameters:

target (Device | DeviceMesh | DeviceMapping)

Return type:

MXFP8Tensor

values_per_byte​

values_per_byte: ClassVar[int] = 1

source

Logical values held per stored weight element.

weight_scale​

weight_scale: Tensor

source

zeros()​

classmethod zeros(shape, *, block_size=(1, 32))

source

Builds a zero-filled MXFP8Tensor of shape [.., rows, cols].

Leading dimensions (such as stacked experts) are kept on both leaves.

Parameters:

Return type:

MXFP8Tensor