diff --git a/paddle/fluid/framework/fleet/fleet_wrapper.cc b/paddle/fluid/framework/fleet/fleet_wrapper.cc index dfe94cf1eb39ae464916c1626d1541741aaeed31..54a647a73cfebb82157ea153da7fc51ec9a3d882 100644 --- a/paddle/fluid/framework/fleet/fleet_wrapper.cc +++ b/paddle/fluid/framework/fleet/fleet_wrapper.cc @@ -914,7 +914,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) {