From ea50d5bd9958578a7174288887b9ff7562c73816 Mon Sep 17 00:00:00 2001 From: buxue Date: Mon, 23 Nov 2020 15:54:07 +0800 Subject: [PATCH] fix the context getcontext is none in del of cell --- mindspore/nn/cell.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mindspore/nn/cell.py b/mindspore/nn/cell.py index 6fa9b5d3319..6467ac46b47 100755 --- a/mindspore/nn/cell.py +++ b/mindspore/nn/cell.py @@ -244,7 +244,7 @@ class Cell(Cell_): raise AttributeError("'{}' object has no attribute '{}'.".format(type(self).__name__, name)) def __del__(self): - if context is not None and context.get_context("mode") == context.PYNATIVE_MODE: + if context.get_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))