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

WeightScaleSpec

WeightScaleSpec

class max.nn.WeightScaleSpec(granularity, dtype, block_size=None)

source

Bases: object

Specifies how weights are scaled for scaled quantization.

Parameters:

block_size

block_size: tuple[int, int] | None = None

source

The tuple[int, int] of the block size for block-wise scaling.

dtype

dtype: DType

source

The DType of the weight scale factor(s).

granularity

granularity: ScaleGranularity

source

The ScaleGranularity of the weight scale factor application.

is_block

property is_block: bool

source

Whether the weight scale granularity is block-wise.

is_colwise

property is_colwise: bool

source

Whether the weight scale granularity is column-wise.

is_rowwise

property is_rowwise: bool

source

Whether the weight scale granularity is row-wise.

is_tensor

property is_tensor: bool

source

Whether the weight scale granularity is per-tensor.