Fix a bug in SaveInputOutputNamesToNodeMapping function (#18456)

### Description
Fix a bug in SaveInputOutputNamesToNodeMapping function. The fix was
provided by Scott.

### Motivation and Context
This commit is contained in:
Changming Sun 2023-11-15 14:51:42 -08:00 committed by GitHub
parent 0a4d76d98b
commit cc840c5289
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 "