chop.passes.graph.calculate_avg_bits_mg_analysis_pass

calculate_avg_bits_mg_analysis_pass

chop.passes.graph.analysis.quantization.calculate_avg_bits.calculate_avg_bits_mg_analysis_pass(graph, pass_args: dict = None)[source]

Calculate, on average, how many bits are spent on weights and activations, this is an analysis on the given graph. This is useful when mixed-precision is happening, we may want to know on-average how many bits are we spending on weights and activations

Parameters:
  • graph (MaseGraph) – The graph to analyze.

  • pass_args (dict) – Additional arguments for the analysis pass.

pass_args can be an empty dictionary or None.

Returns:

A tuple containing the analyzed graph and a dictionary with the average bit values for data and weights.

Return type:

tuple

Return graph:

The analyzed graph.

Rtype graph:

MaseGraph

Return dict:

A dictionary with the following keys: - ‘data_avg_bit’ (float): The average number of bits per value for data. - ‘w_avg_bit’ (float): The average number of bits per value for weights.

Rtype dict:

dict