From 29c47b6b6de8f382811a7eee538d0de9b1569c98 Mon Sep 17 00:00:00 2001 From: sfatimar Date: Sat, 3 Aug 2024 21:30:42 +0530 Subject: [PATCH] Revert "fix handling of multiple QuantizeLinear nodes" --- .../qdq_transformations/qdq_stripping.cc | 33 +++++++++---------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/onnxruntime/core/providers/openvino/qdq_transformations/qdq_stripping.cc b/onnxruntime/core/providers/openvino/qdq_transformations/qdq_stripping.cc index fca681082ef0b..a2b3ed068235b 100644 --- a/onnxruntime/core/providers/openvino/qdq_transformations/qdq_stripping.cc +++ b/onnxruntime/core/providers/openvino/qdq_transformations/qdq_stripping.cc @@ -583,23 +583,22 @@ static void AddQDQNodeUnit(onnxruntime::Graph& dst_graph, // Handle Qs in the NodeUnit if (!node_unit.GetQNodes().empty()) { - for (auto i = 0 ; i < node_unit.GetQNodes().size() ; i++) { - const auto& q_node = node_unit.GetQNodes().at(0); - - SkipReason reason; - - bool keep_q = CheckQRuleSet(node_unit, q_node, src_graph, reason); - - if (keep_q) { - AddNode(initializers_to_keep, src_graph, dst_graph, *q_node); - // if keep_q, then output defs of the target node doesn't change - output_args.push_back(&dst_graph.GetOrCreateNodeArg(target_node.OutputDefs().at(i)->Name(), - target_node.OutputDefs().at(i)->TypeAsProto())); - } else { - // convert this Q to float - output_args.push_back(&ProcessNodeUnitIO(dst_graph, src_graph, initializers_to_keep, - node_unit_outputs.at(i))); - } + ORT_ENFORCE(node_unit.GetQNodes().size() == 1); + const auto& q_node = node_unit.GetQNodes().at(0); + + SkipReason reason; + + bool keep_q = CheckQRuleSet(node_unit, q_node, src_graph, reason); + + if (keep_q) { + AddNode(initializers_to_keep, src_graph, dst_graph, *q_node); + // if keep_q, then output defs of the target node doesn't change + output_args.push_back(&dst_graph.GetOrCreateNodeArg(target_node.OutputDefs().at(0)->Name(), + target_node.OutputDefs().at(0)->TypeAsProto())); + } else { + // convert this Q to float + output_args.push_back(&ProcessNodeUnitIO(dst_graph, src_graph, initializers_to_keep, + node_unit_outputs.at(0))); } } else { for (const auto& node_unit_output : node_unit_outputs) {