提交 470e490b 编写于 作者: Y Yang Zhang

Save optimizer only when it has state

上级 e103f756
...@@ -178,6 +178,8 @@ class StaticGraphAdapter(object): ...@@ -178,6 +178,8 @@ class StaticGraphAdapter(object):
optim_path = path + ".pdopt" optim_path = path + ".pdopt"
optim = {p.name: p for p in filter( optim = {p.name: p for p in filter(
is_belong_to_optimizer, prog.list_vars())} is_belong_to_optimizer, prog.list_vars())}
if not optim:
return
# HACK this is contrived, optimizer state is not the same for # HACK this is contrived, optimizer state is not the same for
# static/dynamic graph mode # static/dynamic graph mode
optim['__static_graph_only__'] = True optim['__static_graph_only__'] = True
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册