未验证 提交 11089cac 编写于 作者: T tianshuo78520a 提交者: GitHub

Fix xpu notest (#28204)

* Fix xpu notest;test=kunlun

* fix

* test=kunlun

* test=kunlun
上级 81244fbf
......@@ -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
......
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)
......@@ -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)
......
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册