From 713c4d0d87e0695e02149b2bbebce366caf5b623 Mon Sep 17 00:00:00 2001 From: Chen Weihang Date: Sun, 7 Aug 2022 22:04:09 -0500 Subject: [PATCH] fix custom op attr names size error (#44938) --- 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 3e7e49fcf4..81ced383eb 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]))); -- GitLab