pytorch
0cae3090 - [Quant] Add get_symmetric_qnnpack_qconfig_mapping (#87002)

Commit
3 years ago
[Quant] Add get_symmetric_qnnpack_qconfig_mapping (#87002) Summary: Today, in order to get XNNPACK quantized ops to work, the user must write some code that refers to private data structures (`_FIXED_QPARAMS_OP_TO_OBSERVER`) to create a QConfigMapping that is compatible with the symmetric constraints in the QNNPACK BackendConfig. This is because `get_default_qconfig("qnnpack")` produces a QConfig that does not satisfy these constraints, and the default QConfigMapping for QNNPACK uses this Qconfig. Instead, we simply put this code into a helper function to make it easier for the user to run XNNPACK quantized ops. In the future, once there is feature parity between the set of ops supported by QNNPACK and XNNPACK, we should revisit whether to simply change `get_default_qconfig("qnnpack")` to return an XNNPACK-compatible QConfig. Test Plan: python test/test_quantization.py TestQuantizeFx.test_symmetric_qnnpack_qconfig_mapping Reviewers: jerryzh168, vkuzo Subscribers: jerryzh168, vkuzo Pull Request resolved: https://github.com/pytorch/pytorch/pull/87002 Approved by: https://github.com/vkuzo
Author
Committer
Parents
Loading