!15852 [GraphKernel]Disable GraphKernel in PynativeMode

From: @dayschan
Reviewed-by: @gaoxiong1,@ckey_dou
Signed-off-by: @ckey_dou
This commit is contained in:
mindspore-ci-bot 2021-04-30 10:27:09 +08:00 committed by Gitee
commit 1e7866eb14
1 changed files with 8 additions and 0 deletions

View File

@ -152,6 +152,14 @@ void GraphKernelFlags::Refresh() {
for (auto &item : flag_map) {
MS_LOG(WARNING) << "Unknown GraphKernel flag: " << item.first;
}
if (opt_level > 0) {
auto context = MsContext::GetInstance();
MS_EXCEPTION_IF_NULL(context);
if (context->get_param<int>(MS_CTX_EXECUTION_MODE) != kGraphMode) {
MS_LOG(WARNING) << "GraphKernel only support GRAPH_MODE";
opt_level = 0;
}
}
}
void GraphKernelFlags::RegisterFlags(std::map<std::string, std::string> *flag_map) {