Polish executor empty program hint message (#22167)

* polish executor hint message, test=develop

* fix punctuation error, test=develop
release/1.7
Chen Weihang 5 years ago committed by GitHub
parent 298ee7d28a
commit 8bed352278
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -792,9 +792,15 @@ class Executor(object):
program = default_main_program()
if isinstance(program, Program) and \
len(program.global_block().ops) == 0:
error_info = "The current program is empty."
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)
if scope is None:

Loading…
Cancel
Save