tf.keras.quantizers.QuantizationReport

Structured summary of a single model.quantize() call.

A report is returned by model.quantize() and also stored on the model as model._quantization_report. It records, per leaf layer, whether the layer was quantized or skipped (with the reason).

The possible skip reasons are available as class attributes on QuantizationReport (SKIP_NO_SUPPORT, SKIP_FILTERED, SKIP_ALREADY_QUANTIZED, SKIP_OUTSIDE_STRUCTURE).

mode The resolved quantization mode for the call (e.g. "int8"). Defaults to None.

mode The resolved quantization mode for the call.
quantized A list of (path, mode, scheme) tuples, one per quantized layer, where scheme is a short description of the resolved quantization scheme (e.g. the layer's dtype-policy name).
skipped A list of (path, reason) tuples. reason is one of SKIP_NO_SUPPORT (the layer does not implement quantization), SKIP_FILTERED (the layer was excluded by filters), SKIP_ALREADY_QUANTIZED (the layer was already quantized), or SKIP_OUTSIDE_STRUCTURE (a GPTQ/AWQ call whose quantization layer structure does not cover the layer).
num_quantized

num_skipped

Methods

add_quantized

View source

add_skipped

View source

render

View source

Return the full report as a multi-line string.

skipped_by_reason

View source

Return the list of layer paths that were skipped for reason.

summary_warning

View source

Return a single warning message, or None if nothing to warn about.

This replaces the previous behavior of emitting one UserWarning per non-quantizable leaf layer with a single message that reports counts and up to max_examples example layer names.

SKIP_ALREADY_QUANTIZED 'already quantized'
SKIP_FILTERED 'filtered out'
SKIP_NO_SUPPORT 'no quantize support'
SKIP_OUTSIDE_STRUCTURE 'outside quantization structure'