From d1572c3e070c2ddf8d59197ebafe548ef0dc63c8 Mon Sep 17 00:00:00 2001 From: Chen Weihang Date: Fri, 5 Aug 2022 12:18:18 +0000 Subject: [PATCH] fix custom op attr names size error --- paddle/fluid/pybind/eager_functions.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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])));