From 11089cacdb802e8f35bcbcbf01b3b959ef77d1aa Mon Sep 17 00:00:00 2001 From: tianshuo78520a <707759223@qq.com> Date: Mon, 26 Oct 2020 10:22:37 +0800 Subject: [PATCH] Fix xpu notest (#28204) * Fix xpu notest;test=kunlun * fix * test=kunlun * test=kunlun --- paddle/scripts/paddle_build.sh | 1 + .../fluid/tests/unittests/xpu/CMakeLists.txt | 3 +++ .../unittests/xpu/test_batch_norm_op_xpu.py | 16 +++++++++------- .../tests/unittests/xpu/test_mean_op_xpu.py | 4 ++-- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/paddle/scripts/paddle_build.sh b/paddle/scripts/paddle_build.sh index 711d6564cfa..87fb6628f42 100755 --- a/paddle/scripts/paddle_build.sh +++ b/paddle/scripts/paddle_build.sh @@ -1200,6 +1200,7 @@ EOF set +x ut_startTime_s=`date +%s` test_cases=$(ctest -N -V | grep "_xpu" ) # cases list which would be run exclusively + get_quickly_disable_ut||disable_ut_quickly='' # indicate whether the case was in quickly disable list while read -r line; do if [[ "$line" == "" ]]; then continue diff --git a/python/paddle/fluid/tests/unittests/xpu/CMakeLists.txt b/python/paddle/fluid/tests/unittests/xpu/CMakeLists.txt index f71e04c09aa..6ac4b93bf6d 100644 --- a/python/paddle/fluid/tests/unittests/xpu/CMakeLists.txt +++ b/python/paddle/fluid/tests/unittests/xpu/CMakeLists.txt @@ -1,6 +1,9 @@ file(GLOB TEST_OPS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "test_*.py") string(REPLACE ".py" "" TEST_OPS "${TEST_OPS}") +list(REMOVE_ITEM TEST_OPS test_concat_op_xpu) +list(REMOVE_ITEM TEST_OPS test_mean_op_xpu) + foreach(TEST_OP ${TEST_OPS}) py_test_modules(${TEST_OP} MODULES ${TEST_OP}) endforeach(TEST_OP) diff --git a/python/paddle/fluid/tests/unittests/xpu/test_batch_norm_op_xpu.py b/python/paddle/fluid/tests/unittests/xpu/test_batch_norm_op_xpu.py index 0d9387d6b75..1cdec863b2a 100644 --- a/python/paddle/fluid/tests/unittests/xpu/test_batch_norm_op_xpu.py +++ b/python/paddle/fluid/tests/unittests/xpu/test_batch_norm_op_xpu.py @@ -159,13 +159,15 @@ class TestXPUBatchNormOp(unittest.TestCase): def test_infer(self): paddle.enable_static() with paddle.static.program_guard(paddle.static.Program()): - x = paddle.data('X', self.x_np.shape, self.x_np.dtype) - scale = paddle.data('Scale', self.scale_np.shape, - self.scale_np.dtype) - bias = paddle.data('Bias', self.bias_np.shape, self.bias_np.dtype) - mean = paddle.data('Mean', self.mean_np.shape, self.mean_np.dtype) - variance = paddle.data('Variance', self.variance_np.shape, - self.variance_np.dtype) + x = paddle.fluid.data('X', self.x_np.shape, self.x_np.dtype) + scale = paddle.fluid.data('Scale', self.scale_np.shape, + self.scale_np.dtype) + bias = paddle.fluid.data('Bias', self.bias_np.shape, + self.bias_np.dtype) + mean = paddle.fluid.data('Mean', self.mean_np.shape, + self.mean_np.dtype) + variance = paddle.fluid.data('Variance', self.variance_np.shape, + self.variance_np.dtype) y = F.batch_norm(x, mean, variance, scale, bias, False, self.momentum, self.epsilon, self.data_layout) exe = paddle.static.Executor(self.place) diff --git a/python/paddle/fluid/tests/unittests/xpu/test_mean_op_xpu.py b/python/paddle/fluid/tests/unittests/xpu/test_mean_op_xpu.py index f43516235c0..3ebdd110d32 100644 --- a/python/paddle/fluid/tests/unittests/xpu/test_mean_op_xpu.py +++ b/python/paddle/fluid/tests/unittests/xpu/test_mean_op_xpu.py @@ -88,7 +88,7 @@ class TestMeanAPI(unittest.TestCase): def test_api_static(self): paddle.enable_static() with paddle.static.program_guard(paddle.static.Program()): - x = paddle.data('X', self.x_shape) + x = paddle.fluid.data('X', self.x_shape) out1 = paddle.mean(x) out2 = paddle.tensor.mean(x) out3 = paddle.tensor.stat.mean(x) @@ -136,7 +136,7 @@ class TestMeanAPI(unittest.TestCase): self.assertRaises(Exception, paddle.mean, x, 2) paddle.enable_static() with paddle.static.program_guard(paddle.static.Program()): - x = paddle.data('X', [10, 12], 'int32') + x = paddle.fluid.data('X', [10, 12], 'int32') self.assertRaises(TypeError, paddle.mean, x) -- GitLab