未验证 提交 dbba9c7e 编写于 作者: Z Zeng Jinle 提交者: GitHub

polish global_value_getter_setter, test=develop (#21332)

上级 a214a308
...@@ -81,7 +81,7 @@ class PYBIND11_HIDDEN GlobalVarGetterSetterRegistry { ...@@ -81,7 +81,7 @@ class PYBIND11_HIDDEN GlobalVarGetterSetterRegistry {
} }
py::object GetOrReturnDefaultValue(const std::string &name, py::object GetOrReturnDefaultValue(const std::string &name,
const py::object &default_value) { const py::object &default_value) const {
if (HasGetterMethod(name)) { if (HasGetterMethod(name)) {
return GetterMethod(name)(); return GetterMethod(name)();
} else { } else {
...@@ -89,7 +89,7 @@ class PYBIND11_HIDDEN GlobalVarGetterSetterRegistry { ...@@ -89,7 +89,7 @@ class PYBIND11_HIDDEN GlobalVarGetterSetterRegistry {
} }
} }
py::object Get(const std::string &name) { return GetterMethod(name)(); } py::object Get(const std::string &name) const { return GetterMethod(name)(); }
const Setter &SetterMethod(const std::string &name) const { const Setter &SetterMethod(const std::string &name) const {
PADDLE_ENFORCE_EQ( PADDLE_ENFORCE_EQ(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册