diff --git a/cmake/external/pybind11.cmake b/cmake/external/pybind11.cmake index e236767cec156b3ed244ee22157e4f2afa5334c8..49e3111bae9c5df77e35eb024b054402c9117c5a 100644 --- a/cmake/external/pybind11.cmake +++ b/cmake/external/pybind11.cmake @@ -16,7 +16,7 @@ include(ExternalProject) set(PYBIND_PREFIX_DIR ${THIRD_PARTY_PATH}/pybind) set(PYBIND_REPOSITORY ${GIT_URL}/pybind/pybind11.git) -set(PYBIND_TAG v2.4.3) +set(PYBIND_TAG v2.6.0) set(PYBIND_INCLUDE_DIR ${THIRD_PARTY_PATH}/pybind/src/extern_pybind/include) include_directories(${PYBIND_INCLUDE_DIR}) diff --git a/python/paddle/fluid/dygraph/varbase_patch_methods.py b/python/paddle/fluid/dygraph/varbase_patch_methods.py index 9f0d8297f349b4a5b1df64e0983ed29aeb19899d..d6d45f23146f8194535923a545a41ac7d75eab91 100644 --- a/python/paddle/fluid/dygraph/varbase_patch_methods.py +++ b/python/paddle/fluid/dygraph/varbase_patch_methods.py @@ -1079,7 +1079,7 @@ def monkey_patch_varbase(): # NOTE(zhiqiu): pybind11 will set a default __str__ method of enum class. # So, we need to overwrite it to a more readable one. # See details in https://github.com/pybind/pybind11/issues/2537. - origin = getattr(core.VarDesc.VarType, "__repr__") + origin = getattr(core.VarDesc.VarType, "__str__") def dtype_str(dtype): if dtype in _PADDLE_DTYPE_2_NUMPY_DTYPE: @@ -1092,7 +1092,7 @@ def monkey_patch_varbase(): # for example, paddle.fluid.core.VarDesc.VarType.LOD_TENSOR return origin(dtype) - setattr(core.VarDesc.VarType, "__repr__", dtype_str) + setattr(core.VarDesc.VarType, "__str__", dtype_str) _already_patch_repr = True # patch math methods for varbase