Skip to main content

Python class

InputScaleSpec

InputScaleSpec

class max.nn.InputScaleSpec(granularity, origin, dtype, activation_scale_ub=None, block_size=None)

source

Bases: object

Specifies how input activations are scaled for scaled quantization.

Parameters:

activation_scale_ub

activation_scale_ub: float | None = None

source

An optional upper bound for dynamic activation scaling.

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 input scale factor(s).

granularity

granularity: ScaleGranularity

source

The ScaleGranularity of the input scale factor application.

is_block

property is_block: bool

source

Whether the input scale granularity is block-wise.

is_colwise

property is_colwise: bool

source

Whether the input scale granularity is column-wise.

is_rowwise

property is_rowwise: bool

source

Whether the input scale granularity is row-wise.

is_tensor

property is_tensor: bool

source

Whether the input scale granularity is per-tensor.

origin

origin: ScaleOrigin

source

The ScaleOrigin (static or dynamic) of the input scale factor.