From 4ed8d4b30e1f176b51ffcb4ab8d44761fb4534d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Do=C5=82bniak?= Date: Wed, 4 Sep 2019 00:09:37 +0200 Subject: [PATCH] Put the initializers at the end of the cluster inputs list (#1751) Restore the missing variable --- .../providers/ngraph/ngraph_execution_provider.cc | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/onnxruntime/core/providers/ngraph/ngraph_execution_provider.cc b/onnxruntime/core/providers/ngraph/ngraph_execution_provider.cc index 60fad0071c..381ca94b61 100644 --- a/onnxruntime/core/providers/ngraph/ngraph_execution_provider.cc +++ b/onnxruntime/core/providers/ngraph/ngraph_execution_provider.cc @@ -438,15 +438,26 @@ static void GetInputsOutputsOfCluster(const GraphViewer& graph_viewer, } const auto& initializers = graph_viewer.GetAllInitializedTensors(); + std::vector const_inputs; for (const auto& in_arg : ordered_input_args) { if ((initializers.count(in_arg) && !original_graph_inputs.count(in_arg)) || ng_required_initializers.count(in_arg)) { - cluster_inputs.push_back(in_arg); - } else if (!output_args.count(in_arg)) { + const_inputs.push_back(in_arg); + } + } + + for (const auto& in_arg : ordered_input_args) { + if (!output_args.count(in_arg) && + !((initializers.count(in_arg) && !original_graph_inputs.count(in_arg)) || + ng_required_initializers.count(in_arg))) { cluster_inputs.push_back(in_arg); } } + for (const auto& in_arg : const_inputs) { + cluster_inputs.push_back(in_arg); + } + std::copy(external_output_args.begin(), external_output_args.end(), std::back_inserter(cluster_outputs)); for (const auto& node_arg : graph_viewer.GetOutputs()) { const auto& name = node_arg->Name();