From 66eefc02716d86a59f453be8dacbcb51e00fced0 Mon Sep 17 00:00:00 2001 From: limingqi107 Date: Sat, 20 Jun 2020 17:59:54 +0800 Subject: [PATCH] reset pynative flag in the resource clear --- mindspore/ccsrc/pynative/pynative_execute.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mindspore/ccsrc/pynative/pynative_execute.cc b/mindspore/ccsrc/pynative/pynative_execute.cc index 676b256d9a2..9f7b0d9ba16 100644 --- a/mindspore/ccsrc/pynative/pynative_execute.cc +++ b/mindspore/ccsrc/pynative/pynative_execute.cc @@ -902,6 +902,11 @@ void PynativeExecutor::Clear(const std::string &flag) { if (flag == "resource") { MS_LOG(INFO) << "Clear res"; Clean(); + // Maybe exit in the pynative runing op, so need reset pynative flag. + auto ms_context = MsContext::GetInstance(); + if (ms_context != nullptr) { + ms_context->set_enable_pynative_infer(false); + } return; } MS_LOG(INFO) << "Clear";