neural_compressor.utils.collect_layer_histogram
¶
LayerHistogramCollector: save the histogram by layer.
Module Contents¶
Classes¶
The collector of the histogram by layer. |
- class neural_compressor.utils.collect_layer_histogram.LayerHistogramCollector(num_bins=8001, layer_tensor=None, include_layer=None, logger=None)¶
Bases:
object
The collector of the histogram by layer.
Saves layer histogram in a dict with layer names as keys and lists of NDArrays as values. The collected histogram will be used for calculating the optimal thresholds for quantization using KL divergence.
- collect()¶
Collect layer output NDArrays as a callback function.