Browse Source

Not AllocateMemory when CompileGraph in PyNative mode

tags/v1.2.0-rc1
tanghuikang 4 years ago
parent
commit
c346a96529
1 changed files with 6 additions and 3 deletions
  1. +6
    -3
      mindspore/ccsrc/backend/session/gpu_session.cc

+ 6
- 3
mindspore/ccsrc/backend/session/gpu_session.cc View File

@@ -387,8 +387,9 @@ GraphId GPUSession::CompileGraphImpl(KernelGraphPtr graph) {
// Update Graph Dynamic Shape Attr.
UpdateGraphDynamicShapeAttr(NOT_NULL(graph));
graph->UpdateGraphDynamicAttr();
const bool pynative_mode = context_ptr->get_param<int>(MS_CTX_EXECUTION_MODE) == kPynativeMode;
// 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());
}
// Build kernel if node is cnode
@@ -407,8 +408,10 @@ GraphId GPUSession::CompileGraphImpl(KernelGraphPtr graph) {
manager->AddFuncGraph(graph);
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
if (debugger_ && debugger_->DebuggerBackendEnabled()) {


Loading…
Cancel
Save