From 022ed57679ac2170f2af85c2f23bbe0f3a75ed7c Mon Sep 17 00:00:00 2001 From: Randy Shuai Date: Thu, 14 Dec 2023 17:59:24 -0800 Subject: [PATCH] rely on iterator instead of operator[] --- onnxruntime/core/framework/allocation_planner.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/onnxruntime/core/framework/allocation_planner.cc b/onnxruntime/core/framework/allocation_planner.cc index 9556e056dedc0..ea7a6432a7507 100644 --- a/onnxruntime/core/framework/allocation_planner.cc +++ b/onnxruntime/core/framework/allocation_planner.cc @@ -1035,8 +1035,11 @@ class PlannerImpl { std::function dfs = [&](NodeIndex curr) { if (dependents.find(curr) == dependents.end()) { dependents.insert(curr); - for (NodeIndex dep : dependence_graph_[curr]) { - dfs(dep); + auto dep_graph_iter = dependence_graph_.find(curr); + if (dep_graph_iter != dependence_graph_.end()) { + for (NodeIndex dep : dep_graph_iter->second) { + dfs(dep); + } } } };