Skip to content

Commit

Permalink
Revert "[security] refine _get_program_cache_key (PaddlePaddle#61827) (
Browse files Browse the repository at this point in the history
…PaddlePaddle#61896)"

This reverts commit b6a38d0.
  • Loading branch information
hanhaowen-mt committed May 13, 2024
1 parent b17e2bc commit e171a3a
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions python/paddle/base/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -682,19 +682,15 @@ def _get_varname_from_block(block):
)


def _get_feed_fetch_var_names(feed, fetch_list):
def _get_program_cache_key(feed, fetch_list):
feed_var_names = []
if isinstance(feed, dict):
feed_var_names = list(feed.keys())
elif isinstance(feed, (list, tuple)):
for i, each in enumerate(feed):
feed_var_names += list(each.keys())
fetch_var_names = list(map(_to_name_str, fetch_list))
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))
return str(feed_var_names + fetch_var_names)


def _as_lodtensor(data, place, dtype=None):
Expand Down Expand Up @@ -1030,7 +1026,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 = _get_feed_fetch_var_names(feed, fetch_list)
skip_var_names = eval(_get_program_cache_key(feed, fetch_list))
_apply_inplace_addto_pass(
program, enable_inplace, enable_addto, skip_var_names
)
Expand Down

0 comments on commit e171a3a

Please sign in to comment.