| 650 | |
| 651 | |
| 652 | def 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 | |
| 683 | def get_lpai_target_env(qnn_config: QnnConfig): |