Skip to content

Commit

Permalink
[CPU-PSLIB] Add clearer error log when sparse key name is not int typ…
Browse files Browse the repository at this point in the history
…e, test=develop (PaddlePaddle#34173)
  • Loading branch information
WorgenZhang authored and zhangfan50 committed Jul 16, 2021
1 parent e0aa1d6 commit afcecdf
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion paddle/fluid/framework/fleet/fleet_wrapper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,14 @@ void FleetWrapper::PushSparseVarsWithLabelAsync(
int64_t* ids = tensor->data<int64_t>();
int slot = 0;
if (dump_slot) {
slot = boost::lexical_cast<int>(sparse_key_names[i]);
try {
slot = boost::lexical_cast<int>(sparse_key_names[i]);
} catch (boost::bad_lexical_cast const& e) {
PADDLE_THROW(platform::errors::PreconditionNotMet(
"sparse var's name: %s, doesn't support non-integer type name when "
"dump_slot=True",
sparse_key_names[i]));
}
}
Variable* g_var = scope.FindVar(sparse_grad_names[i]);
if (g_var == nullptr) {
Expand Down

0 comments on commit afcecdf

Please sign in to comment.