diff --git a/mindspore/ccsrc/session/ascend_session.cc b/mindspore/ccsrc/session/ascend_session.cc index a8626a202b3b513a89323ecbf9ea5a0d8a08f18e..288fe0bbb85fc68c85177c8008f74e28caa05cda 100644 --- a/mindspore/ccsrc/session/ascend_session.cc +++ b/mindspore/ccsrc/session/ascend_session.cc @@ -289,6 +289,12 @@ GraphId AscendSession::CompileGraph(NotNull func_graph) { std::vector all_graphs; auto root_graph = ConstructKernelGraph(func_graph, &all_graphs); BackendOptimization(all_graphs); + // empty graph dont entry to backend + if (root_graph->execution_order().empty()) { + MS_LOG(INFO) << root_graph->ToString() << " is empty graph."; + InitRuntimeResource(); + return root_graph->graph_id(); + } // split switch SplitGraphs(NOT_NULL(root_graph)); // insert goto labels and label_sets