diff --git a/paddle/fluid/pybind/eager_functions.cc b/paddle/fluid/pybind/eager_functions.cc index 61bdbdafa812c..ff786911ee55d 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])));