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

[new-exec] avoid adding_feed_fetch in each run (#38672)

上级 e1187e50
......@@ -1385,23 +1385,24 @@ class Executor(object):
key = _get_strong_program_cache_key(inner_program, feed,
fetch_list)
program = self._add_feed_fetch_ops(
program=inner_program,
feed=feed,
fetch_list=fetch_list,
feed_var_name=feed_var_name,
fetch_var_name=fetch_var_name,
use_fetch_v2=True)
# a little bit tricy here, use inner_program before _add_feed_fetch_ops to get key
# while use program to geet _StandaloneExecutor
if key not in self._executor_cache._cached_executors:
program = self._add_feed_fetch_ops(
program=inner_program,
feed=feed,
fetch_list=fetch_list,
feed_var_name=feed_var_name,
fetch_var_name=fetch_var_name,
use_fetch_v2=True)
new_program = program.clone()
new_exe = _StandaloneExecutor(self.place, new_program,
scope)
self._executor_cache._cached_executors[key] = new_exe
self._executor_cache._cached_executors[key] = (new_program,
new_exe)
new_exe = self._executor_cache._cached_executors[key]
program, new_exe = self._executor_cache._cached_executors[key]
self._feed_data(program, feed, feed_var_name, scope)
if hasattr(program, 'lr_sheduler'):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册