提交 b63901f5 编写于 作者: Q qiaolongfei

optimize program_cache_key, delete cache when use_program_cache is false

上级 82a8e080
...@@ -260,14 +260,17 @@ class Executor(object): ...@@ -260,14 +260,17 @@ class Executor(object):
scope = global_scope() scope = global_scope()
program_cache = None program_cache = None
program_cache_key = None
feed_var_names = feed.keys()
fetch_var_names = [var.desc.name() for var in fetch_list]
program_cache_key = str(feed_var_names + fetch_var_names)
if use_program_cache: if use_program_cache:
# find program cache by cache_key # find program cache by cache_key
feed_var_names = feed.keys()
fetch_var_names = [var.desc.name() for var in fetch_list]
program_cache_key = str(feed_var_names + fetch_var_names)
program_cache = self.program_caches.get(program_cache_key, None) program_cache = self.program_caches.get(program_cache_key, None)
# TODO(qiao): Should check program_cache and program are exactly the same. # TODO(qiao): Should check program_cache and program are exactly the same.
else:
self.program_caches.pop(program_cache_key, None)
if program_cache is None: if program_cache is None:
program_cache = program.clone() program_cache = program.clone()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册