未验证 提交 b7782ea7 编写于 作者: L Leo Chen 提交者: GitHub

sync program when need, test=develop (#22803)

上级 53a2b68f
......@@ -3991,6 +3991,11 @@ class Program(object):
The two code snippets above will generate and print same programs.
"""
#NOTE(zhiqiu): we sync the original program first, since its program may diff with
# its desc due to modifying desc in c++ space. E.g. save op will add kLookupTablePath in desc.
self._sync_with_cpp()
pruned_origin_block_id_map = None
if for_test:
forward_prog = Program()
......@@ -4015,6 +4020,8 @@ class Program(object):
p.__op_role_var = self.__op_role_var
p._appending_grad_times = self._appending_grad_times
#NOTE(zhiqiu): we sync the cloned program, to update its program by
# its desc.
p._sync_with_cpp()
p._copy_param_info_from(self)
......@@ -4038,6 +4045,10 @@ class Program(object):
Program: A new, pruned program.
"""
#NOTE(zhiqiu): we sync the original program first, since its program may diff with
# its desc due to modifying desc in c++ space. E.g. save op will add kLookupTablePath in desc.
self._sync_with_cpp()
if not isinstance(targets, list):
targets = [targets]
......@@ -4093,6 +4104,10 @@ class Program(object):
Program: A new, pruned program.
"""
#NOTE(zhiqiu): we sync the original program first, since its program may diff with
# its desc due to modifying desc in c++ space. E.g. save op will add kLookupTablePath in desc.
self._sync_with_cpp()
if not isinstance(feeded_var_names, list):
feeded_var_names = [feeded_var_names]
if not isinstance(targets, list):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册