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

Polish fetch error message of parallel executor (#22206)

* polish error message of parallel executor, test=develop

* change PADDLE_ENFORCE, test=develop
上级 2e90c4eb
......@@ -142,8 +142,11 @@ void FastThreadedSSAGraphExecutor::InsertFetchOps(
PADDLE_ENFORCE_NE(
fetched_var_it, fetched_vars->end(),
platform::errors::PreconditionNotMet(
"Cannot find fetched variable(%s). Perhaps the main_program "
"is not set to ParallelExecutor.",
"Cannot find fetched variable(%s) in current computation graph. "
"Possible reasons are:\n"
" 1. The variable to be fetched is not defined in main program.\n"
" 2. The variable to be fetched is not an input or output of any "
"operator.",
var_name));
auto &vars = fetched_var_it->second;
......
......@@ -170,10 +170,15 @@ void ThreadedSSAGraphExecutor::InsertFetchOps(
for (size_t i = 0; i < fetch_tensors.size(); ++i) {
auto &var_name = fetch_tensors[i];
auto fetched_var_it = fetched_vars.find(var_name);
PADDLE_ENFORCE(fetched_var_it != fetched_vars.end(),
"Cannot find fetched variable(%s).(Perhaps the main_program "
"is not set to ParallelExecutor)",
var_name);
PADDLE_ENFORCE_NE(
fetched_var_it, fetched_vars.end(),
platform::errors::PreconditionNotMet(
"Cannot find fetched variable(%s) in current computation graph. "
"Possible reasons are:\n"
" 1. The variable to be fetched is not defined in main program.\n"
" 2. The variable to be fetched is not an input or output of any "
"operator.",
var_name));
auto &vars = fetched_var_it->second;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册