!30583 Fix I4TZAN: Don't throw exception while cell id not in cache.

Merge pull request !30583 from zhangzhaoju/r1.6
This commit is contained in:
i-robot 2022-02-26 01:50:51 +00:00 committed by Gitee
commit 4e2d42453c
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 3 additions and 1 deletions

View File

@ -322,7 +322,9 @@ class Cell(Cell_):
if context.get_context is not None and context._get_mode() == context.PYNATIVE_MODE:
_pynative_executor.del_cell(str(id(self)))
cells_compile_cache.pop(id(self))
# while deepcopy a cell instance, the copied cell instance can't be added to cells_compile_cache
# here using pop(id(self), None) to avoid KeyError exception
cells_compile_cache.pop(id(self), None)
if self.compile_cache:
_cell_graph_executor.del_net_res(self.compile_cache)