qualia_codegen_core.graph.Quantization module

Contains the Quantization class to hold quantization settings in a model graph node.

class qualia_codegen_core.graph.Quantization.Quantization(number_type: type[int | float] | None = None, width: int | None = None, long_width: int | None = None, weights_width: int | None = None, bias_width: int | None = None, output_width: int | None = None, weights_scale_factor: int | None = None, bias_scale_factor: int | None = None, output_scale_factor: int | None = None, weights_round_mode: RoundMode | None = None, output_round_mode: RoundMode | None = None)[source]

Bases: object

Holds quantization settings in a model graph node.

number_type: type[int | float] | None = None

Number abstract data type, either float for floating-point coding or int for fixed-point coding

width: int | None = None

Total number of bits to use to encode a value (output, bias and weights)

long_width: int | None = None

Larger number of bits to use for temporary values during computation in C code

weights_width: int | None = None

Not used in C code, total number of bits to use to encode weights

bias_width: int | None = None

Not used in C code, total number of bits to use to encode biases

output_width: int | None = None

Not used in C code, total number of bits to use to encode outputs

weights_scale_factor: int | None = None

Number of bits for the fractional part of weights

bias_scale_factor: int | None = None

Number of bits for the fractional part of biases

output_scale_factor: int | None = None

Number of bits for the fractional part of outputs

weights_round_mode: RoundMode | None = None

Rounding mode to use when quantizing weights

output_round_mode: RoundMode | None = None

Rounding mode to use when quantizing outputs

asdict() dict[str, Any][source]

Return the data from this class as a dictionary.

Returns:

a dictionary with each attribute and property of this dataclass as keys and the associated values