!17664 fix I3TGGM: set_train in step loop, performance slows down.

From: @zhangzhaoju
Reviewed-by: @ginfung,@zh_qh
Signed-off-by: @zh_qh
This commit is contained in:
mindspore-ci-bot 2021-06-08 08:33:03 +08:00 committed by Gitee
commit f89f811dc3
1 changed files with 4 additions and 2 deletions

View File

@ -1018,12 +1018,14 @@ class Cell(Cell_):
def add_flags_recursive(self, **flags):
self.add_flags(**flags)
if hasattr(self, '_cell_init_args'):
self._cell_init_args += str({**flags})
for cell in self.cells():
cell.add_flags_recursive(**flags)
return self
def _add_init_args(self, **args):
if hasattr(self, '_cell_init_args'):
self._cell_init_args += str({**args})
def get_flags(self):
if not hasattr(self, "_mindspore_flags"):
self._mindspore_flags = {}