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

revert-22710-feature/integrated_ps_api
Leo Chen 5 years ago committed by GitHub
parent 53a2b68f4e
commit b7782ea7c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -3991,6 +3991,11 @@ class Program(object):
The two code snippets above will generate and print same programs. 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 pruned_origin_block_id_map = None
if for_test: if for_test:
forward_prog = Program() forward_prog = Program()
@ -4015,6 +4020,8 @@ class Program(object):
p.__op_role_var = self.__op_role_var p.__op_role_var = self.__op_role_var
p._appending_grad_times = self._appending_grad_times 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._sync_with_cpp()
p._copy_param_info_from(self) p._copy_param_info_from(self)
@ -4038,6 +4045,10 @@ class Program(object):
Program: A new, pruned program. 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): if not isinstance(targets, list):
targets = [targets] targets = [targets]
@ -4093,6 +4104,10 @@ class Program(object):
Program: A new, pruned program. 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): if not isinstance(feeded_var_names, list):
feeded_var_names = [feeded_var_names] feeded_var_names = [feeded_var_names]
if not isinstance(targets, list): if not isinstance(targets, list):

Loading…
Cancel
Save