!8949 fix bug when change attr after a Cell was defined

From: @wangnan39
Reviewed-by: @zh_qh
Signed-off-by: @zh_qh
This commit is contained in:
mindspore-ci-bot 2020-11-25 16:29:30 +08:00 committed by Gitee
commit 63bb481ddb
1 changed files with 2 additions and 0 deletions

View File

@ -401,6 +401,8 @@ class Cell(Cell_):
if self._auto_prefix:
value.update_parameters_name(name + '.')
cells[name] = value
if hasattr(self, '_cell_init_args'):
self.cell_init_args += str({name: value})
elif params and name in params:
if isinstance(value, Tensor) and self._params[name] is not None:
self._params[name].set_data(value)