support kunlun matmul_v2 (#27910)

*test=kunlun
my_2.0rc
QingshuChen 4 years ago committed by GitHub
parent 5a83496c8d
commit 2712d07644
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

File diff suppressed because it is too large Load Diff

@ -28,6 +28,8 @@ import time
paddle.enable_static() paddle.enable_static()
@unittest.skipIf(not paddle.is_compiled_with_xpu(),
"core is not compiled with XPU")
class TestMulOpError(unittest.TestCase): class TestMulOpError(unittest.TestCase):
def test_errors(self): def test_errors(self):
with program_guard(Program(), Program()): with program_guard(Program(), Program()):
@ -43,6 +45,8 @@ class TestMulOpError(unittest.TestCase):
self.assertRaises(TypeError, fluid.layers.mul, x3, x4) self.assertRaises(TypeError, fluid.layers.mul, x3, x4)
@unittest.skipIf(not paddle.is_compiled_with_xpu(),
"core is not compiled with XPU")
class TestXPUMulOp1(OpTest): class TestXPUMulOp1(OpTest):
def setUp(self): def setUp(self):
self.op_type = "mul" self.op_type = "mul"
@ -67,18 +71,23 @@ class TestXPUMulOp1(OpTest):
pass pass
def test_check_output(self): def test_check_output(self):
self.check_output() place = paddle.XPUPlace(0)
self.check_output_with_place(place, atol=0.01)
def test_check_grad_normal(self): def test_check_grad_normal(self):
self.check_grad(['X', 'Y'], 'Out', max_relative_error=0.1) place = paddle.XPUPlace(0)
self.check_grad_with_place(
place, ['X', 'Y'], 'Out', max_relative_error=0.1)
def test_check_grad_ingore_x(self): def test_check_grad_ingore_x(self):
self.check_grad( place = paddle.XPUPlace(0)
['Y'], 'Out', max_relative_error=0.1, no_grad_set=set('X')) self.check_grad_with_place(
place, ['Y'], 'Out', max_relative_error=0.1, no_grad_set=set("X"))
def test_check_grad_ignore_y(self): def test_check_grad_ignore_y(self):
self.check_grad( place = paddle.XPUPlace(0)
['X'], 'Out', max_relative_error=0.1, no_grad_set=set('Y')) self.check_grad_with_place(
place, ['X'], 'Out', max_relative_error=0.1, no_grad_set=set('Y'))
@unittest.skipIf(not paddle.is_compiled_with_xpu(), @unittest.skipIf(not paddle.is_compiled_with_xpu(),

Loading…
Cancel
Save