diff --git a/paddle/fluid/pybind/eager_functions.cc b/paddle/fluid/pybind/eager_functions.cc index 3e7e49fcf45d5631ac3550ff5e707c61b00898f4..81ced383eb36a26a4f3061e927ffc9a814a38018 100644 --- a/paddle/fluid/pybind/eager_functions.cc +++ b/paddle/fluid/pybind/eager_functions.cc @@ -333,8 +333,7 @@ static std::vector CastAttrsToTragetType( src.size())); for (size_t i = 0; i < src.size(); i++) { size_t end = attrs_names[i].find(": "); - std::string type_name = - attrs_names[i].substr(end + 2, attrs_names.size() - end - 2); + std::string type_name = attrs_names[i].substr(end + 2); if (type_name == "int") { if (src[i].type() == typeid(bool)) { res.emplace_back(static_cast(paddle::any_cast(src[i])));