diff --git a/paddle/fluid/pybind/global_value_getter_setter.cc b/paddle/fluid/pybind/global_value_getter_setter.cc index 108764f9bfbaab1945c4e675670415c4f7ccd6a2..10c9fb8bdbe7a52209479179102dd3afcf57f2a4 100644 --- a/paddle/fluid/pybind/global_value_getter_setter.cc +++ b/paddle/fluid/pybind/global_value_getter_setter.cc @@ -81,7 +81,7 @@ class PYBIND11_HIDDEN GlobalVarGetterSetterRegistry { } py::object GetOrReturnDefaultValue(const std::string &name, - const py::object &default_value) { + const py::object &default_value) const { if (HasGetterMethod(name)) { return GetterMethod(name)(); } else { @@ -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 { PADDLE_ENFORCE_EQ(