Interactive visualization¶
Context¶
Interactive visualization displays the range (min and max values) of activations and weights for all quantized modules
in the quantization simulation QuantizationSimModel
object.
Interactive visualization functionality includes:
Adjustable threshold values to flag layers for which min or max activations or weights exceed these values
Tables containing names and ranges for layers exceeding threshold values
Workflow¶
tbd
API¶
Warning
This feature is under heavy development and API changes may occur without notice in future versions.
- aimet_torch.v2.visualization_tools.visualize_stats(sim, dummy_input, save_path='./quant_stats_visualization.html')[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.
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, save_path="./quant_stats_visualization.html")
- Parameters:
sim (
QuantizationSimModel
) – Calibrated QuantizationSimModeldummy_input – Sample input used to trace the model
save_path (
str
) – Path for saving the visualization. Default is “./quant_stats_visualization.html”
- Return type:
None
Interactive visualization does not support TensorFlow.
Interactive visualization does not support ONNX.