Browse Source

!8841 Fix context none type bug

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

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

@@ -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