未验证 提交 1f686744 编写于 作者: C chengduo 提交者: GitHub

refine executor bug info (#19887)

test=develop
上级 ae593e57
...@@ -621,11 +621,15 @@ class Executor(object): ...@@ -621,11 +621,15 @@ class Executor(object):
if self._closed: if self._closed:
raise RuntimeError("Attempted to use a closed Executor") raise RuntimeError("Attempted to use a closed Executor")
use_default_main_program = program is None
if program is None: if program is None:
program = default_main_program() program = default_main_program()
if isinstance(program,Program) and \ if isinstance(program, Program) and \
len(program.global_block().ops) == 0: len(program.global_block().ops) == 0:
warnings.warn("The current program is empty.") error_info = "The current program is empty."
if use_default_main_program:
error_info += " Maybe you should pass the Program or the CompiledProgram manually."
warnings.warn(error_info)
if scope is None: if scope is None:
scope = global_scope() scope = global_scope()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册