Fix onnx quantizer activation and weight type attribute (#17651)

In
[`quantize_subgraph`](https://github.com/microsoft/onnxruntime/blob/v1.16.0/onnxruntime/python/tools/quantization/onnx_quantizer.py#L188-L189)
`self.weight_qType` and `self.activation_qType` are
[integers](https://github.com/microsoft/onnxruntime/blob/v1.16.0/onnxruntime/python/tools/quantization/onnx_quantizer.py#L115-L116)
while `ONNXQuantizer` expects `QuantType`
This commit is contained in:
Ella Charlaix 2023-10-01 03:06:34 +02:00 committed by GitHub
parent 0d60604638
commit 63acaf47d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -112,8 +112,8 @@ class ONNXQuantizer:
False if "ActivationSymmetric" not in self.extra_options else self.extra_options["ActivationSymmetric"]
)
self.activation_qType = activation_qType.tensor_type
self.weight_qType = weight_qType.tensor_type
self.activation_qType = getattr(activation_qType, "tensor_type", activation_qType)
self.weight_qType = getattr(weight_qType, "tensor_type", weight_qType)
"""
Dictionary specifying the min and max values for tensors. It has following format:
{