Browse Source

!8902 fix the context getcontext is none in del of cell

From: @zhangbuxue
Reviewed-by: @chujinjin,@zh_qh
Signed-off-by: @zh_qh,@chujinjin
tags/v1.1.0
mindspore-ci-bot Gitee 5 years ago
parent
commit
c030dffd68
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      mindspore/nn/cell.py

+ 1
- 1
mindspore/nn/cell.py View File

@@ -247,7 +247,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))


Loading…
Cancel
Save