diff --git a/mindspore/ccsrc/utils/graph_utils.cc b/mindspore/ccsrc/utils/graph_utils.cc index e956498a3f2..03ac14573df 100644 --- a/mindspore/ccsrc/utils/graph_utils.cc +++ b/mindspore/ccsrc/utils/graph_utils.cc @@ -23,10 +23,10 @@ #include #include #include -#include #include #include #include +#include #include #include "common/utils.h" @@ -37,9 +37,11 @@ namespace mindspore { std::vector TopoSort(const AnfNodePtr &root, const SuccFunc &succ, const IncludeFunc &include) { size_t seen = NewSeenGeneration(); - std::list todo(1, root); + std::deque todo(1024); std::unordered_map rank; std::vector res; + todo.clear(); + todo.push_back(root); while (!todo.empty()) { AnfNodePtr node = todo.back();