diff --git a/python/paddle/base/executor.py b/python/paddle/base/executor.py index e86e3d33a40a4..6fe3f71d481ca 100755 --- a/python/paddle/base/executor.py +++ b/python/paddle/base/executor.py @@ -684,7 +684,7 @@ def _get_varname_from_block(block): ) -def _get_program_cache_key(feed, fetch_list): +def _get_feed_fetch_var_names(feed, fetch_list): feed_var_names = [] if isinstance(feed, dict): feed_var_names = list(feed.keys()) @@ -692,7 +692,11 @@ def _get_program_cache_key(feed, fetch_list): for i, each in enumerate(feed): feed_var_names += list(each.keys()) fetch_var_names = list(map(_to_name_str, fetch_list)) - return str(feed_var_names + fetch_var_names) + return feed_var_names + fetch_var_names + + +def _get_program_cache_key(feed, fetch_list): + return str(_get_feed_fetch_var_names(feed, fetch_list)) def _as_lodtensor(data, place, dtype=None): @@ -1028,7 +1032,7 @@ def _get_program_and_executor(self, cached_data): if enable_inplace or enable_addto: # inplace should skip feed and fetch var - skip_var_names = eval(_get_program_cache_key(feed, fetch_list)) + skip_var_names = _get_feed_fetch_var_names(feed, fetch_list) _apply_inplace_addto_pass( program, enable_inplace, enable_addto, skip_var_names )