From cc840c5289e581997ace2f6e414558ca8b886e90 Mon Sep 17 00:00:00 2001 From: Changming Sun Date: Wed, 15 Nov 2023 14:51:42 -0800 Subject: [PATCH] Fix a bug in SaveInputOutputNamesToNodeMapping function (#18456) ### Description Fix a bug in SaveInputOutputNamesToNodeMapping function. The fix was provided by Scott. ### Motivation and Context --- onnxruntime/core/framework/session_state_utils.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/onnxruntime/core/framework/session_state_utils.cc b/onnxruntime/core/framework/session_state_utils.cc index df3a7afebc..df11fe8302 100644 --- a/onnxruntime/core/framework/session_state_utils.cc +++ b/onnxruntime/core/framework/session_state_utils.cc @@ -455,11 +455,10 @@ common::Status SaveInputOutputNamesToNodeMapping(const onnxruntime::GraphViewer& // utils::CopyOneInputAcrossDevices is happy. auto& input_map = session_state.GetInputNodeInfoMap(); - auto end_map = input_map.cend(); for (const auto& graph_input : graph_inputs) { const auto& name = graph_input->Name(); - if (input_map.find(name) == end_map) { + if (input_map.find(name) == input_map.cend()) { // dummy entry for an input that we didn't find a use of in the graph. log it in case that's a bug. // utils::CopyOneInputAcrossDevices will use the input OrtValue as is given we don't believe it's used anywhere. LOGS(session_state.Logger(), INFO) << (graph.IsSubgraph() ? "Subgraph" : "Graph") << " input with name "