diff --git a/python/paddle/fluid/executor.py b/python/paddle/fluid/executor.py index f571cc666e5644acb508bbb53ae11c684cf92172..c9e4118f4511445101090a71412e781cea733533 100644 --- a/python/paddle/fluid/executor.py +++ b/python/paddle/fluid/executor.py @@ -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: