Warning
This feature is under heavy development and API changes may occur without notice in future versions.
Visualization Tools
- aimet_torch.v2.visualization_tools.visualize_stats(sim, dummy_input, save_path=None)[source]
Produces an interactive html to view the stats collected by each quantizer during calibration
Note
The QuantizationSimModel input is expected to have been calibrated before using this function. Stats will only be plotted for activations/parameters with quantizers containing calibration statistics.
Currently, this tool is only compatible with quantizers containing
MinMaxEncodingAnalyzer
encoding analyzers (i.e.,QuantScheme.post_training_tf
andQuantScheme.training_range_learning_with_tf_init
quant schemes).Creates an interactive visualization of min and max activations/weights of all quantized modules in the input QuantSim object. The features include:
Adjustable threshold values to flag layers whose min or max activations/weights exceed the set thresholds
Tables containing names and ranges for layers exceeding threshold values
Saves the visualization as a .html at the given path.
Example
>>> sim = aimet_torch.v2.quantsim.QuantizationSimModel(model, dummy_input, quant_scheme=QuantScheme.post_training_tf) >>> with aimet_torch.v2.nn.compute_encodings(sim.model): ... for data, _ in data_loader: ... sim.model(data) ... >>> visualize_stats(sim, dummy_input, "./quant_stats_visualization.html")
- Parameters:
sim (
QuantizationSimModel
) – Calibrated QuantizationSimModeldummy_input – Sample input used to trace the model
save_path (
Optional
[str
]) – Path for saving the visualization. Default is “./quant_stats_visualization.html”
- Return type:
None