MCPcopy
hub / github.com/OpenPPL/ppq / report

Method report

ppq/quantization/quantizer/base.py:223–247  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

221 return {'Relu', 'Clip'}
222
223 def report(self) -> str:
224 debug_str = ''
225 # stats:
226 quant_ops = [op for op in self._graph.operations.values() if isinstance(op, QuantableOperation)]
227 quant_vars = [var for var in self._graph.variables.values() if isinstance(var, QuantableVariable)]
228 quant_cfgs = []
229
230 config_states_cnt = {state: 0 for state in QuantizationStates}
231 for op in quant_ops:
232 for cfg, _ in op.config_with_variable:
233 config_states_cnt[cfg.state] += 1
234 quant_cfgs.append(cfg)
235
236 debug_str += '--------- Network Snapshot ---------\n'
237 debug_str += f'Num of Op: [{len(self._graph.operations)}]\n'
238 debug_str += f'Num of Quantized Op: [{len(quant_ops)}]\n'
239 debug_str += f'Num of Variable: [{len(self._graph.variables)}]\n'
240 debug_str += f'Num of Quantized Var: [{len(quant_vars)}]\n'
241 debug_str += '------- Quantization Snapshot ------\n'
242 debug_str += f'Num of Quant Config: [{len(quant_cfgs)}]\n'
243 for state, cnt in config_states_cnt.items():
244 if cnt <= 0: continue
245 padding_str = ' ' * max(28 - len(state.name), 0)
246 debug_str += f'{state.name}:{padding_str} [{cnt}]\n'
247 return debug_str
248
249 def build_quant_pipeline(self, setting: QuantizationSetting) -> QuantizationOptimizationPipeline:
250 assert isinstance(setting, QuantizationSetting), (

Callers 1

quantizeMethod · 0.95

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected