From b7782ea7c32b3a9721496c11768451635a89e6e2 Mon Sep 17 00:00:00 2001 From: Leo Chen Date: Mon, 2 Mar 2020 11:39:30 +0800 Subject: [PATCH] sync program when need, test=develop (#22803) --- python/paddle/fluid/framework.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/python/paddle/fluid/framework.py b/python/paddle/fluid/framework.py index a13f6edf8d..ebd02101c2 100644 --- a/python/paddle/fluid/framework.py +++ b/python/paddle/fluid/framework.py @@ -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): -- GitLab