onnxruntime
927b53ae - Fix/qdq optional zero point input (#32051)

Commit
30 days ago
Fix/qdq optional zero point input (#32051) This pull request enhances the handling of optional inputs for quantized operators, ensuring correctness when optional zero point inputs are omitted and improving code robustness. The most important changes are grouped below: **Core Functionality Improvements:** * Added a new utility function `SetOptionalInput` in `s8_to_u8.cc` to correctly set optional input slots in a node, updating both input definitions and input argument counts, and handling omitted inputs gracefully. [[1]](diffhunk://#diff-f1ed8d1a3ceb3229c24831a98c511aa862d535a8ba3c486bd7ca47a2244b4fe4R8-R32) [[2]](diffhunk://#diff-b6b2ee740008dfb1616c212a5fe976a30a489e83e7da3f5389d63487025fc0f7R78-R79) * Updated logic in both `TryConvertDynamicQuantizeLSTM` and `ConvertS8WeightToU8` to use `SetOptionalInput` when assigning new initializers for zero point inputs, ensuring proper handling of optional inputs. [[1]](diffhunk://#diff-9082e1a8710cae2bf43315ecca905dc65fb8e13956287506b7f71134c777803bL140-R141) [[2]](diffhunk://#diff-9082e1a8710cae2bf43315ecca905dc65fb8e13956287506b7f71134c777803bL151-R153) [[3]](diffhunk://#diff-f1ed8d1a3ceb3229c24831a98c511aa862d535a8ba3c486bd7ca47a2244b4fe4L51-R77) **Bug Fixes and Robustness:** * Modified checks for zero point input existence to require both non-null and `.Exists()`, preventing errors when optional inputs are omitted. [[1]](diffhunk://#diff-9082e1a8710cae2bf43315ecca905dc65fb8e13956287506b7f71134c777803bL76-R76) [[2]](diffhunk://#diff-9082e1a8710cae2bf43315ecca905dc65fb8e13956287506b7f71134c777803bL88-R90) [[3]](diffhunk://#diff-f1ed8d1a3ceb3229c24831a98c511aa862d535a8ba3c486bd7ca47a2244b4fe4L29-R54) **Testing Improvements:** * Added a new unit test `MatMulIntegerOmittedZeroPoints` to verify that the transformer correctly handles omitted zero point inputs, fills in optional input slots, and generates the expected uint8 initializer.
Author
Parents
Loading