diff --git a/mindspore/ccsrc/backend/session/ascend_session.cc b/mindspore/ccsrc/backend/session/ascend_session.cc index f61c15e415..920914160a 100644 --- a/mindspore/ccsrc/backend/session/ascend_session.cc +++ b/mindspore/ccsrc/backend/session/ascend_session.cc @@ -121,9 +121,6 @@ GraphId AscendSession::CompileGraphImpl(const AnfNodePtrList &lst, const AnfNode MS_LOG(INFO) << "Start"; // construct graph, if successfully, graph_sum_ + 1 auto graph = ConstructKernelGraph(lst, outputs); - // Update Graph Dynamic Shape Attr - UpdateGraphDynamicShapeAttr(NOT_NULL(graph)); - graph->UpdateGraphDynamicAttr(); auto graph_id = graph->graph_id(); MS_LOG(INFO) << "Compile graph " << graph_id << " success"; return graph_id; diff --git a/mindspore/ccsrc/backend/session/session_basic.cc b/mindspore/ccsrc/backend/session/session_basic.cc index 9ad14a0245..fea200bde9 100644 --- a/mindspore/ccsrc/backend/session/session_basic.cc +++ b/mindspore/ccsrc/backend/session/session_basic.cc @@ -851,6 +851,10 @@ KernelGraphPtr SessionBasic::ConstructKernelGraph(const AnfNodePtrList &lst, con if (ExistSummaryNode(graph.get())) { graph->set_summary_node_exist(true); } + + // Update Graph Dynamic Shape Attr + UpdateGraphDynamicShapeAttr(NOT_NULL(graph)); + opt::BackendCommonOptimization(graph); graph->SetInputNodes(); graph->SetOptimizerFlag(); @@ -1493,6 +1497,7 @@ void SessionBasic::UpdateGraphDynamicShapeAttr(const NotNull &ro MS_LOG(INFO) << "Set Input Dynamic Shape Attr to Node:" << cnode->fullname_with_scope(); } } + root_graph->UpdateGraphDynamicAttr(); } #if (ENABLE_CPU && (ENABLE_D || ENABLE_GPU)) diff --git a/mindspore/ccsrc/runtime/device/ascend/ascend_kernel_runtime.cc b/mindspore/ccsrc/runtime/device/ascend/ascend_kernel_runtime.cc index 3b02fbd839..c984b6fd86 100644 --- a/mindspore/ccsrc/runtime/device/ascend/ascend_kernel_runtime.cc +++ b/mindspore/ccsrc/runtime/device/ascend/ascend_kernel_runtime.cc @@ -376,8 +376,7 @@ bool AscendKernelRuntime::GenTask(const session::KernelGraph *graph) { InnerSetContext(); if (graph->is_dynamic_shape()) { if (ConfigManager::GetInstance().dataset_mode() == DS_SINK_MODE) { - MS_LOG(EXCEPTION) - << "Dynamic shape is not supported with dataset_sink_mode=True. Please set dataset_sink_mode=False"; + MS_LOG(EXCEPTION) << "Dynamic shape is not supported with sink mode."; } if (DumpJsonParser::GetInstance().async_dump_enabled()) { MS_LOG(EXCEPTION) << "Dynamic shape is not supported with asyn dump. Please use other debugging methods.";