Polish fetch error message of parallel executor (#22206)

* polish error message of parallel executor, test=develop

* change PADDLE_ENFORCE, test=develop
revert-22710-feature/integrated_ps_api
Chen Weihang 5 years ago committed by GitHub
parent 2e90c4eb0a
commit fc0b21e17b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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;

Loading…
Cancel
Save