Browse Source

bugfix for restore context

tags/v1.3.0
y00500818 3 years ago
parent
commit
246d7e4fd8
1 changed files with 6 additions and 5 deletions
  1. +6
    -5
      ge/generator/ge_generator.cc

+ 6
- 5
ge/generator/ge_generator.cc View File

@@ -674,6 +674,12 @@ Status GeGenerator::GenerateModel(const Graph &graph, const string &file_name_pr
GELOGD("Current ctx is null."); GELOGD("Current ctx is null.");
ctx = nullptr; ctx = nullptr;
} }
std::function<void()> callback = [&]() {
if (ctx != nullptr) {
(void)rtCtxSetCurrent(ctx);
}
};
GE_MAKE_GUARD(restore, callback);


GeRootModelPtr ge_root_model = nullptr; GeRootModelPtr ge_root_model = nullptr;
GE_CHECK_NOTNULL_EXEC(impl_, return PARAM_INVALID); GE_CHECK_NOTNULL_EXEC(impl_, return PARAM_INVALID);
@@ -712,11 +718,6 @@ Status GeGenerator::GenerateModel(const Graph &graph, const string &file_name_pr
} }
return ret; return ret;
} }

if (ctx != nullptr) {
(void)rtCtxSetCurrent(ctx);
}

return SUCCESS; return SUCCESS;
} }




Loading…
Cancel
Save