From 8bed352278085f2ba14dcdc29072e4eee9ad95c1 Mon Sep 17 00:00:00 2001 From: Chen Weihang Date: Fri, 10 Jan 2020 10:20:38 +0800 Subject: [PATCH] Polish executor empty program hint message (#22167) * polish executor hint message, test=develop * fix punctuation error, test=develop --- python/paddle/fluid/executor.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/python/paddle/fluid/executor.py b/python/paddle/fluid/executor.py index f571cc666e5..c9e4118f451 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: -- GitLab