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

Method __call__

ppq/samples/custimize_quant_func.py:18–22  ·  view source on GitHub ↗
(self, tensor: torch.Tensor, config: TensorQuantizationConfig)

Source from the content-addressed store, hash-verified

16 register your delegator with executor.register_quantize_delegate
17 """
18 def __call__(self, tensor: torch.Tensor, config: TensorQuantizationConfig) -> torch.Tensor:
19 if config.policy.has_property(QuantizationProperty.ASYMMETRICAL):
20 raise ValueError('Sorry, this delegator handles only Symmetrical Quantizations.')
21 print('You are invoking cusitmized quant function now.')
22 return torch.round(tensor / config.scale) * config.scale
23
24BATCHSIZE = 32
25INPUT_SHAPE = [3, 224, 224]

Callers

nothing calls this directly

Calls 1

has_propertyMethod · 0.80

Tested by

no test coverage detected