!8841 Fix context none type bug

From: @zjun3021
Reviewed-by: @chujinjin,@kisnwang
Signed-off-by: @chujinjin
pull/8841/MERGE
mindspore-ci-bot 4 years ago committed by Gitee
commit f052ce8ba2

@ -244,7 +244,7 @@ class Cell(Cell_):
raise AttributeError("'{}' object has no attribute '{}'.".format(type(self).__name__, name))
def __del__(self):
if context.get_context("mode") == context.PYNATIVE_MODE:
if context is not None and context.get_context("mode") == context.PYNATIVE_MODE:
_pynative_exec.clear(str(id(self)))
if hasattr(self, "_create_time"):
_executor.del_net_res(str(self._create_time))

Loading…
Cancel
Save