Revert "update the version of pybind, test=develop (#28284)"

This reverts commit d9b5f1261c.
revert-28284-dev/pybind_version
Zhou Wei 5 years ago committed by GitHub
parent 0f4b6247c8
commit 7cbd0d1e3f

@ -17,7 +17,7 @@ include(ExternalProject)
set(PYBIND_PREFIX_DIR ${THIRD_PARTY_PATH}/pybind) set(PYBIND_PREFIX_DIR ${THIRD_PARTY_PATH}/pybind)
set(PYBIND_SOURCE_DIR ${THIRD_PARTY_PATH}/pybind/src/extern_pybind) set(PYBIND_SOURCE_DIR ${THIRD_PARTY_PATH}/pybind/src/extern_pybind)
SET(PYBIND_REPOSITORY ${GIT_URL}/pybind/pybind11.git) SET(PYBIND_REPOSITORY ${GIT_URL}/pybind/pybind11.git)
SET(PYBIND_TAG v2.4.3) SET(PYBIND_TAG v2.2.4)
cache_third_party(extern_pybind cache_third_party(extern_pybind
REPOSITORY ${PYBIND_REPOSITORY} REPOSITORY ${PYBIND_REPOSITORY}
@ -34,6 +34,7 @@ ExternalProject_Add(
"${PYBIND_DOWNLOAD_CMD}" "${PYBIND_DOWNLOAD_CMD}"
PREFIX ${PYBIND_PREFIX_DIR} PREFIX ${PYBIND_PREFIX_DIR}
SOURCE_DIR ${PYBIND_SOURCE_DIR} SOURCE_DIR ${PYBIND_SOURCE_DIR}
UPDATE_COMMAND ""
CONFIGURE_COMMAND "" CONFIGURE_COMMAND ""
BUILD_COMMAND "" BUILD_COMMAND ""
INSTALL_COMMAND "" INSTALL_COMMAND ""

@ -58,7 +58,7 @@ struct npy_format_descriptor<paddle::platform::float16> {
// https://docs.python.org/3/library/struct.html#format-characters. // https://docs.python.org/3/library/struct.html#format-characters.
return "e"; return "e";
} }
static constexpr auto name = _("float16"); static PYBIND11_DESCR name() { return _("float16"); }
}; };
// Note: Since bfloat16 is not a builtin type in C++ and in numpy, // Note: Since bfloat16 is not a builtin type in C++ and in numpy,
@ -75,7 +75,7 @@ struct npy_format_descriptor<paddle::platform::bfloat16> {
// https://docs.python.org/3/library/struct.html#format-characters. // https://docs.python.org/3/library/struct.html#format-characters.
return "H"; return "H";
} }
static constexpr auto name = _("bfloat16"); static PYBIND11_DESCR name() { return _("bfloat16"); }
}; };
} // namespace detail } // namespace detail

@ -1261,11 +1261,6 @@ class Executor(object):
"Executor requires Program as its Parameter. But you passed in %s" "Executor requires Program as its Parameter. But you passed in %s"
% (type(program))) % (type(program)))
if not isinstance(fetch_var_name, str):
raise TypeError(
"The name of fetch variable requires string as its Parameter. But you passed in %s"
% (type(fetch_var_name)))
if use_program_cache: if use_program_cache:
cache_key = _get_strong_program_cache_key(program, feed, fetch_list) cache_key = _get_strong_program_cache_key(program, feed, fetch_list)
cached_program = self._get_program_cache(cache_key) cached_program = self._get_program_cache(cache_key)
@ -1316,7 +1311,7 @@ class Executor(object):
if not use_program_cache: if not use_program_cache:
self._default_executor.run(program.desc, scope, 0, True, True, self._default_executor.run(program.desc, scope, 0, True, True,
[fetch_var_name]) fetch_var_name)
else: else:
self._default_executor.run_prepared_ctx(ctx, scope, False, False, self._default_executor.run_prepared_ctx(ctx, scope, False, False,
False) False)

@ -86,8 +86,14 @@ class TestFeedData(unittest.TestCase):
self._test_feed_lod_tensor(use_cuda, use_parallel_executor) self._test_feed_lod_tensor(use_cuda, use_parallel_executor)
# Test exception message when feeding with error # Test exception message when feeding with error
in_shape_tuple = (-1, 3, 4, 8) if six.PY2:
error_shape_list = [self.data_batch_size, 3, 4, 5] in_shape_tuple = (long(-1), long(3), long(4), long(8))
error_shape_list = [
long(self.data_batch_size), long(3), long(4), long(5)
]
else:
in_shape_tuple = (-1, 3, 4, 8)
error_shape_list = [self.data_batch_size, 3, 4, 5]
with self.assertRaises(ValueError) as shape_mismatch_err: with self.assertRaises(ValueError) as shape_mismatch_err:
self._test_feed_data_shape_mismatch(use_cuda, self._test_feed_data_shape_mismatch(use_cuda,

@ -430,7 +430,18 @@ class TestVarBase(unittest.TestCase):
paddle.set_printoptions(4, 100, 3) paddle.set_printoptions(4, 100, 3)
a_str = str(a) a_str = str(a)
expected = '''Tensor(shape=[10, 20], dtype=float32, place=CPUPlace, stop_gradient=True, if six.PY2:
expected = '''Tensor(shape=[10L, 20L], dtype=float32, place=CPUPlace, stop_gradient=True,
[[0.2727, 0.5489, 0.8655, ..., 0.2916, 0.8525, 0.9000],
[0.3806, 0.8996, 0.0928, ..., 0.9535, 0.8378, 0.6409],
[0.1484, 0.4038, 0.8294, ..., 0.0148, 0.6520, 0.4250],
...,
[0.3426, 0.1909, 0.7240, ..., 0.4218, 0.2676, 0.5679],
[0.5561, 0.2081, 0.0676, ..., 0.9778, 0.3302, 0.9559],
[0.2665, 0.8483, 0.5389, ..., 0.4956, 0.6862, 0.9178]])'''
else:
expected = '''Tensor(shape=[10, 20], dtype=float32, place=CPUPlace, stop_gradient=True,
[[0.2727, 0.5489, 0.8655, ..., 0.2916, 0.8525, 0.9000], [[0.2727, 0.5489, 0.8655, ..., 0.2916, 0.8525, 0.9000],
[0.3806, 0.8996, 0.0928, ..., 0.9535, 0.8378, 0.6409], [0.3806, 0.8996, 0.0928, ..., 0.9535, 0.8378, 0.6409],
[0.1484, 0.4038, 0.8294, ..., 0.0148, 0.6520, 0.4250], [0.1484, 0.4038, 0.8294, ..., 0.0148, 0.6520, 0.4250],
@ -447,7 +458,12 @@ class TestVarBase(unittest.TestCase):
a = paddle.to_tensor([[1.5111111, 1.0], [0, 0]]) a = paddle.to_tensor([[1.5111111, 1.0], [0, 0]])
a_str = str(a) a_str = str(a)
expected = '''Tensor(shape=[2, 2], dtype=float32, place=CPUPlace, stop_gradient=True, if six.PY2:
expected = '''Tensor(shape=[2L, 2L], dtype=float32, place=CPUPlace, stop_gradient=True,
[[1.5111, 1. ],
[0. , 0. ]])'''
else:
expected = '''Tensor(shape=[2, 2], dtype=float32, place=CPUPlace, stop_gradient=True,
[[1.5111, 1. ], [[1.5111, 1. ],
[0. , 0. ]])''' [0. , 0. ]])'''
@ -459,7 +475,12 @@ class TestVarBase(unittest.TestCase):
a = paddle.to_tensor([[-1.5111111, 1.0], [0, -0.5]]) a = paddle.to_tensor([[-1.5111111, 1.0], [0, -0.5]])
a_str = str(a) a_str = str(a)
expected = '''Tensor(shape=[2, 2], dtype=float32, place=CPUPlace, stop_gradient=True, if six.PY2:
expected = '''Tensor(shape=[2L, 2L], dtype=float32, place=CPUPlace, stop_gradient=True,
[[-1.5111, 1. ],
[ 0. , -0.5000]])'''
else:
expected = '''Tensor(shape=[2, 2], dtype=float32, place=CPUPlace, stop_gradient=True,
[[-1.5111, 1. ], [[-1.5111, 1. ],
[ 0. , -0.5000]])''' [ 0. , -0.5000]])'''

Loading…
Cancel
Save