|
|
|
@ -253,10 +253,14 @@ class API_TestMm(unittest.TestCase):
|
|
|
|
|
exe = fluid.Executor(fluid.CPUPlace())
|
|
|
|
|
data1 = np.random.rand(3, 2)
|
|
|
|
|
data2 = np.random.rand(2, 3)
|
|
|
|
|
np_res, np_y_1 = exe.run(feed={'x': data1,
|
|
|
|
|
'y': data2},
|
|
|
|
|
fetch_list=[res, y_1])
|
|
|
|
|
self.assertEqual((np_res == np_y_1).all(), True)
|
|
|
|
|
np_res, expected_result = exe.run(feed={'x': data1,
|
|
|
|
|
'y': data2},
|
|
|
|
|
fetch_list=[res, y_1])
|
|
|
|
|
self.assertTrue(
|
|
|
|
|
np.allclose(
|
|
|
|
|
np.array(np_res), np.array(expected_result), atol=1e-5),
|
|
|
|
|
"two value is\
|
|
|
|
|
{}\n{}, check diff!".format(np_res, expected_result))
|
|
|
|
|
|
|
|
|
|
with fluid.program_guard(fluid.Program()):
|
|
|
|
|
x = fluid.data(name="x", shape=[2], dtype="float64")
|
|
|
|
@ -270,7 +274,11 @@ class API_TestMm(unittest.TestCase):
|
|
|
|
|
expected_result = np.matmul(
|
|
|
|
|
data1.reshape(1, 2), data2.reshape(2, 1))
|
|
|
|
|
|
|
|
|
|
self.assertEqual((np_res == expected_result).all(), True)
|
|
|
|
|
self.assertTrue(
|
|
|
|
|
np.allclose(
|
|
|
|
|
np_res, expected_result, atol=1e-5),
|
|
|
|
|
"two value is\
|
|
|
|
|
{}\n{}, check diff!".format(np_res, expected_result))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class API_TestMmError(unittest.TestCase):
|
|
|
|
|