| @@ -387,8 +387,9 @@ GraphId GPUSession::CompileGraphImpl(KernelGraphPtr graph) { | |||||
| // Update Graph Dynamic Shape Attr. | // Update Graph Dynamic Shape Attr. | ||||
| UpdateGraphDynamicShapeAttr(NOT_NULL(graph)); | UpdateGraphDynamicShapeAttr(NOT_NULL(graph)); | ||||
| graph->UpdateGraphDynamicAttr(); | graph->UpdateGraphDynamicAttr(); | ||||
| const bool pynative_mode = context_ptr->get_param<int>(MS_CTX_EXECUTION_MODE) == kPynativeMode; | |||||
| // Hide NopOp from execution graph in graph mode | // Hide NopOp from execution graph in graph mode | ||||
| if (context_ptr->get_param<int>(MS_CTX_EXECUTION_MODE) != kPynativeMode) { | |||||
| if (!pynative_mode) { | |||||
| opt::HideNopNode(graph.get()); | opt::HideNopNode(graph.get()); | ||||
| } | } | ||||
| // Build kernel if node is cnode | // Build kernel if node is cnode | ||||
| @@ -407,8 +408,10 @@ GraphId GPUSession::CompileGraphImpl(KernelGraphPtr graph) { | |||||
| manager->AddFuncGraph(graph); | manager->AddFuncGraph(graph); | ||||
| graph->set_manager(manager); | graph->set_manager(manager); | ||||
| } | } | ||||
| // Alloc memory, including static memory and dynamic memory | |||||
| AllocateMemory(graph.get()); | |||||
| // Alloc memory in graph mode, including static memory and dynamic memory | |||||
| if (!pynative_mode) { | |||||
| AllocateMemory(graph.get()); | |||||
| } | |||||
| #ifdef ENABLE_DEBUGGER | #ifdef ENABLE_DEBUGGER | ||||
| if (debugger_ && debugger_->DebuggerBackendEnabled()) { | if (debugger_ && debugger_->DebuggerBackendEnabled()) { | ||||