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))
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_e4m3fnweight data of shape[.., rows, cols]. - weight_scale (Tensor) – Per-block
float8_e8m0fnuscales of shape[.., ceil(rows / block_m), ceil(cols / block_k)], in checkpoint order; the matmuls interleave them for the kernel (seematmul()). - block_size (tuple[int, int]) – Per-block size as
(block_m, block_k);(1, 32)for MXFP8.
- weight (Tensor) –
block_size
Quantization block shape as (rows, cols).
local_shards
property local_shards: tuple[MXFP8Tensor, ...]
Per-device shards, pairing each weight shard with its scales.
mesh
property mesh: DeviceMesh
Device mesh of the weight tensor.
scale_dtype
Dtype of weight_scale.
shard()
shard(axis, mesh)
Co-shard weight/weight_scale along axis onto mesh.
-
Parameters:
-
- axis (int)
- mesh (DeviceMesh)
-
Return type:
storage_dtype
Dtype of the stored weight.
to()
to(target)
Returns a copy with weight and weight_scale on target.
-
Parameters:
-
target (Device | DeviceMesh | DeviceMapping)
-
Return type:
values_per_byte
Logical values held per stored weight element.
weight_scale
weight_scale: Tensor
zeros()
classmethod zeros(shape, *, block_size=(1, 32))
Builds a zero-filled MXFP8Tensor of shape [.., rows, cols].
Leading dimensions (such as stacked experts) are kept on both leaves.