chop.passes.module.transform.quantize#
calculate_avg_bits_module_analysis_pass#
- chop.passes.module.analysis.quantize.calculate_avg_bits_module_analysis_pass(module: Module, pass_args: dict = {}) tuple [source]#
Analyzes the averaged weight bitwidth of a given module. Considering only Linear and Conv2d layers.
- Parameters:
module (torch.nn.Module) – The module to analyze.
pass_args (dict) – Additional arguments for the analysis pass. (default: {})
- Returns:
A tuple containing the modified module and a dictionary with the analysis results.
- Return type:
tuple(torch.nn.Module, dict)
- analysis results is a dictionary with the following keys:
‘average_bitwidth’ (float): The average number of bits per value for weight.
Examples output:
info = { # this means on average each weight value is represented by 16 bits 'average_bitwidth': 16.0}