MCPcopy Create free account
hub / github.com/pytorch/executorch / make_quantizer

Function make_quantizer

backends/qualcomm/export_utils.py:652–680  ·  view source on GitHub ↗
(
    quant_dtype: Optional[QuantDtype] = QuantDtype.use_8a8w,
    custom_annotations=(),
    per_channel_conv=True,
    per_channel_linear=False,
    per_channel_embedding=False,
    act_observer=MovingAverageMinMaxObserver,
    act_symmetric=False,
    is_qat=False,
    submodule_qconfig_list: Optional[List[Tuple[Callable, ModuleQConfig]]] = None,
    backend=QnnExecuTorchBackendType.kHtpBackend,
    soc_model="SM8750",
    eps=None,
)

Source from the content-addressed store, hash-verified

650
651
652def make_quantizer(
653 quant_dtype: Optional[QuantDtype] = QuantDtype.use_8a8w,
654 custom_annotations=(),
655 per_channel_conv=True,
656 per_channel_linear=False,
657 per_channel_embedding=False,
658 act_observer=MovingAverageMinMaxObserver,
659 act_symmetric=False,
660 is_qat=False,
661 submodule_qconfig_list: Optional[List[Tuple[Callable, ModuleQConfig]]] = None,
662 backend=QnnExecuTorchBackendType.kHtpBackend,
663 soc_model="SM8750",
664 eps=None,
665):
666 quantizer = QnnQuantizer(backend=backend, soc_model=getattr(QcomChipset, soc_model))
667 quantizer.add_custom_quant_annotations(custom_annotations)
668 quantizer.set_default_quant_config(
669 quant_dtype,
670 is_qat=is_qat,
671 is_conv_per_channel=per_channel_conv,
672 is_linear_per_channel=per_channel_linear,
673 is_embedding_per_channel=per_channel_embedding,
674 act_observer=act_observer,
675 act_symmetric=act_symmetric,
676 eps=eps,
677 )
678 submodule_qconfig_list = submodule_qconfig_list or []
679 quantizer.set_submodule_qconfig_list(submodule_qconfig_list)
680 return quantizer
681
682
683def get_lpai_target_env(qnn_config: QnnConfig):

Calls 4

QnnQuantizerClass · 0.90