dmx.compressor.numerical.format

Classes

BlockFloatingPoint([precision, block_size, ...])

This is a block floating point format simulated in FP32, using QPyTorch.

FixedPoint(precision, fraction[, clamp, ...])

This is a fixed point format simulated in FP32, using QPyTorch.

FloatingPoint([mantissa, exponent, bias, ...])

This is a floating point format simulated in FP32, using QPyTorch.

Format()

This is an abstract class of tensor numerical format.

MXFP(element_format[, block_size])

This is a MXFP tensor format.

MXINT([precision, block_size])

This is a MXINT tensor format.

Same()

This is a dummy numerical format whose cast() does not do anything but passing same input through.

ScaledBlockFloatingPoint(block_format, ...)

This is a scaled block floating point tensor format.

class dmx.compressor.numerical.format.BlockFloatingPoint(precision=8, block_size=64, symmetric=True, rounding='nearest')

Bases: Format

This is a block floating point format simulated in FP32, using QPyTorch.

property bfp_id
property bit_precision: float
blocked: bool = True
property bytes_per_elem: float
cast(x: Tensor, block_dim: int)
classmethod from_shorthand(sh: str)
static make_mantissa_asymmetric(dmx_result, fp32_inp, n_mantissa_bits=8)
class dmx.compressor.numerical.format.FixedPoint(precision, fraction, clamp=True, symmetric=True, rounding='nearest')

Bases: Format

This is a fixed point format simulated in FP32, using QPyTorch.

property bit_precision: float
blocked: bool = False
property bytes_per_elem: float
cast(x, *args)
classmethod from_shorthand(sh: str)
class dmx.compressor.numerical.format.FloatingPoint(mantissa=23, exponent=8, bias=None, flush_subnormal=True, unsigned=False, rounding='nearest')

Bases: Format

This is a floating point format simulated in FP32, using QPyTorch.

property bit_precision: float
blocked: bool = False
property bytes_per_elem: float
cast(x, *args)
classmethod from_shorthand(sh: str)
property largest_representable_power_of_two
class dmx.compressor.numerical.format.Format

Bases: ABC

This is an abstract class of tensor numerical format. Child classes to implement cast() and from_shorthand() method.

bfp_id: int | None = None
property bit_precision: float | None
blocked: bool
property bytes_per_elem: float | None
cast(*input: Any)
static from_shorthand(sh: str)
class dmx.compressor.numerical.format.MXFP(element_format: FloatingPoint, block_size=32)

Bases: Format

This is a MXFP tensor format.

property bit_precision: float
blocked: bool = True
property bytes_per_elem: float
cast(x: Tensor, block_dim: int) Tensor
classmethod from_shorthand(sh: str)
class dmx.compressor.numerical.format.MXINT(precision=8, block_size=32)

Bases: BlockFloatingPoint

This is a MXINT tensor format.

classmethod from_shorthand(sh: str)
class dmx.compressor.numerical.format.Same

Bases: Format

This is a dummy numerical format whose cast() does not do anything but passing same input through.

property bit_precision: float | None
blocked: bool = False
property bytes_per_elem: None
cast(x, *args)
classmethod from_shorthand(sh: str)
class dmx.compressor.numerical.format.ScaledBlockFloatingPoint(block_format: FixedPoint, scaler_format: FloatingPoint, block_size=64)

Bases: Format

This is a scaled block floating point tensor format.

property bfp_id
property bit_precision: float
blocked: bool = True
property bytes_per_elem: float
cast(x: Tensor, block_dim: int) Tensor
determine_scaler_exponent_bias_from(x: Tensor) None

Determines scaler_format.bias based on the value of the quantized tensor as a side-effect

classmethod from_shorthand(sh: str)