Commits


Yilun Huang authored and GitHub committed 6ac7c894bf1
[bug fixed] use different node names for different dedicated QDQ pairs (#14258) ### Description <!-- Describe your changes. --> Bug fixed: Quantized models cannot be loaded into ort.InferenceSession when DedicatedQDQPair is True in extra_options of QDQQuantizer. Solutions: Add postfix to node names of dedicated QDQ pairs similar to tensor names of them. ### Motivation and Context <!-- - Why is this change required? What problem does it solve? - If it fixes an open issue, please link to the issue here. --> Loading quantized model fails when setting `DedicatedQDQPair` to `True` in `extra_options` and raise an error as below: ``` Fail: [ONNXRuntimeError] : 1 : FAIL : Load model from mobilenetv2-opset10-quantized-dedicated.onnx failed:This is an invalid model. Error: two nodes with same node name (489_QuantizeLinear). ``` After visualizing the quantized model using netron, we can find that both the dedicated QDQ pairs for tensor 489 have the same node names of "489_QuantizeLinear". So I found that in QDQQuantizer, there is no unique postfix for the node names of dedicated QDQ pairs. <img width="1171" alt="image" src="https://user-images.githubusercontent.com/12782861/212010296-f8cc05ce-c20e-4189-a692-aaf4bbac3a29.png"> Therefore, I add postfix to node names of QDQ pairs similar to doing so to tensor names. After this modification, the quantized model can be loaded successfully and dedicated QDQ pairs have different node names.👌🏻 <img width="1037" alt="image" src="https://user-images.githubusercontent.com/12782861/212010594-78eba39d-eab6-4d77-9ecd-b55f5303bcf4.png">