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

Method build_observer

ppq/quantization/observer/__init__.py:31–37  ·  view source on GitHub ↗
(cls, variable: Variable, config: TensorQuantizationConfig)

Source from the content-addressed store, hash-verified

29
30 @ classmethod
31 def build_observer(cls, variable: Variable, config: TensorQuantizationConfig) -> BaseTensorObserver:
32 algorithm = str(config.observer_algorithm.lower())
33 if algorithm not in OBSERVER_TABLE:
34 raise ValueError(
35 f'Observer type not understand, Except one of {OBSERVER_TABLE.keys()}, '\
36 f'while {str(algorithm)} was given.')
37 return OBSERVER_TABLE[algorithm](watch_on=variable, quant_cfg=config)
38
39
40class CalibrationHook(QuantOPRuntimeHook):

Callers 3

optimizeMethod · 0.80
build_hookMethod · 0.80
ObserverFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected