未验证 提交 8bed3522 编写于 作者: C Chen Weihang 提交者: GitHub

Polish executor empty program hint message (#22167)

* polish executor hint message, test=develop

* fix punctuation error, test=develop
上级 298ee7d2
...@@ -792,9 +792,15 @@ class Executor(object): ...@@ -792,9 +792,15 @@ class Executor(object):
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:
error_info = "The current program is empty."
if use_default_main_program: if use_default_main_program:
error_info += " Maybe you should pass the Program or the CompiledProgram manually." error_info = "Now you are using default_main_program, "\
"but there are no operators in the program to be executed. "\
"Please ensure you create model correctly or you can pass "\
"the Program or the CompiledProgram manually."
else:
error_info = "There are no operators in the program to be executed. "\
"If you pass Program manually, please use fluid.program_guard "\
"to ensure the current Program is being used."
warnings.warn(error_info) warnings.warn(error_info)
if scope is None: if scope is None:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册