diff --git a/paddle/fluid/framework/fleet/fleet_wrapper.cc b/paddle/fluid/framework/fleet/fleet_wrapper.cc index f80e735bdc7cc2892b67de8890fd6e2411498d2f..6287c9d2acc0bc3e6e7332c3d0b0597c754a9986 100644 --- a/paddle/fluid/framework/fleet/fleet_wrapper.cc +++ b/paddle/fluid/framework/fleet/fleet_wrapper.cc @@ -575,7 +575,14 @@ void FleetWrapper::PushSparseVarsWithLabelAsync( int64_t* ids = tensor->data(); int slot = 0; if (dump_slot) { - slot = boost::lexical_cast(sparse_key_names[i]); + try { + slot = boost::lexical_cast(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) {