diff --git a/mindspore/ccsrc/pipeline/jit/pipeline.cc b/mindspore/ccsrc/pipeline/jit/pipeline.cc index 94608391983..231fdf5dcc4 100644 --- a/mindspore/ccsrc/pipeline/jit/pipeline.cc +++ b/mindspore/ccsrc/pipeline/jit/pipeline.cc @@ -397,7 +397,14 @@ py::dict ExecutorPy::GetAllreduceFusion(const std::string &phase) { return mindspore::parallel::GetAllreduceFusion(graph); } +// Not support multi thread, not support nested call too. +// Here using nested_called flg to avoid nested call. void ExecutorPy::DelNetRes(const std::string &id) { + static bool nested_called = false; + if (nested_called) { + return; + } + nested_called = true; #ifdef ENABLE_GE FinalizeBackend(); #else @@ -425,6 +432,7 @@ void ExecutorPy::DelNetRes(const std::string &id) { } #endif } + nested_called = false; } void ExecutorPy::ClearRes() { diff --git a/mindspore/ccsrc/vm/graph_partition.cc b/mindspore/ccsrc/vm/graph_partition.cc index dd0647a8edb..884e6ff5a3f 100644 --- a/mindspore/ccsrc/vm/graph_partition.cc +++ b/mindspore/ccsrc/vm/graph_partition.cc @@ -58,7 +58,7 @@ void CalcNodeRefCount(const FuncGraphPtr &graph, std::map *n queue.push(graph->get_return()); std::set visited; while (!queue.empty()) { - auto &node = queue.front(); + auto node = queue.front(); queue.pop(); MS_EXCEPTION_IF_NULL(node); if (!node->isa()) {