未验证 提交 352babaa 编写于 作者: C Chen Weihang 提交者: GitHub

Fix test_custom_relu_op_jit windows error (#45812)

* fix test_custom_relu_op_jit windows error

* polish assert format
上级 fe169bf1
...@@ -111,17 +111,9 @@ class TestJITLoad(unittest.TestCase): ...@@ -111,17 +111,9 @@ class TestJITLoad(unittest.TestCase):
custom_relu_dynamic(custom_module.custom_relu, 'cpu', 'int32', x) custom_relu_dynamic(custom_module.custom_relu, 'cpu', 'int32', x)
except OSError as e: except OSError as e:
caught_exception = True caught_exception = True
self.assertTrue( self.assertTrue("relu_cpu_forward" in str(e))
"function \"relu_cpu_forward\" is not implemented for data type `int32`" self.assertTrue("int32" in str(e))
in str(e)) self.assertTrue("custom_relu_op.cc" in str(e))
if IS_WINDOWS:
self.assertTrue(
r"python\paddle\fluid\tests\custom_op\custom_relu_op.cc" in
str(e))
else:
self.assertTrue(
"python/paddle/fluid/tests/custom_op/custom_relu_op.cc" in
str(e))
self.assertTrue(caught_exception) self.assertTrue(caught_exception)
caught_exception = False caught_exception = False
# MAC-CI don't support GPU # MAC-CI don't support GPU
...@@ -132,12 +124,9 @@ class TestJITLoad(unittest.TestCase): ...@@ -132,12 +124,9 @@ class TestJITLoad(unittest.TestCase):
custom_relu_dynamic(custom_module.custom_relu, 'gpu', 'int32', x) custom_relu_dynamic(custom_module.custom_relu, 'gpu', 'int32', x)
except OSError as e: except OSError as e:
caught_exception = True caught_exception = True
self.assertTrue( self.assertTrue("relu_cuda_forward_kernel" in str(e))
"function \"relu_cuda_forward_kernel\" is not implemented for data type `int32`" self.assertTrue("int32" in str(e))
in str(e)) self.assertTrue("custom_relu_op.cu" in str(e))
self.assertTrue(
"python/paddle/fluid/tests/custom_op/custom_relu_op.cu" in str(
e))
self.assertTrue(caught_exception) self.assertTrue(caught_exception)
def test_exception(self): def test_exception(self):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册