Expand description
Quantization data representation. Quantization data representation.
Structs§
- Block
Layout - Which block each element of a tensor falls in, for a block scheme. A block is a rectangle, so its members are a run of the flat storage only when it spans the trailing dimension; anything walking values against block scales asks here rather than chunking.
- Block
Scale - The per-block scale level of a
QuantScheme: one scale per block of values. - Block
Size - Copyable block size, specialized version of
SmallVec. - Decoded
Scales - Scales recovered from a quantized byte buffer.
- QParam
Tensor - A quantization parameter tensor descriptor.
- QParams
- The quantization tensor data parameters.
- Quant
Config - Configuration for a device quantization behavior.
- Quant
Scheme - Describes a quantization scheme/configuration.
- Quantized
Bytes - Quantized data bytes representation.
Enums§
- Calibration
- Calibration method used to compute the quantization range mapping.
- Quant
Acc - The precision of accumulating elements.
- Quant
Mode - Strategy used to quantize values.
- Quant
Propagation - Specify if the output of an operation is quantized using the scheme of the input or returned unquantized.
- Quant
Store - Data type used to stored quantized values.
- Quant
Value - Data type used to represent quantized values.
- Scale
Dtype - The data type a scale level stores its scales in.
Constants§
- QPARAM_
ALIGN - Alignment (in bytes) for quantization parameters in serialized tensor data.
Functions§
- global_
scale_ dtype - The dtype of the per-tensor scale block scales are normalized against, for a two-level scheme.
- global_
scale_ size - Bytes taken by the per-tensor scale, zero for a scheme that does not carry one over blocks.
- pack_
i8s_ to_ u32s - Pack signed 8-bit integer values into a sequence of unsigned 32-bit integers.
- params_
shape - Calculate the shape of the block scale grid for a given tensor and scheme.
- quantizable
- Whether a backend can quantize against this scheme’s scales.
- quantized_
data_ len - Total bytes a tensor of
shapeoccupies underscheme, laid out asQuantizedBytes::newwrites it: values, then block scales, then (for a two-level scheme) the per-tensor scale. - scale_
size - Bytes per stored scale entry for the given scale dtype.
- scale_
to_ dtype - Round a scale up to the smallest value representable by the scale dtype that is no smaller.