diff --git a/python/paddle/fluid/tests/unittests/test_activation_op.py b/python/paddle/fluid/tests/unittests/test_activation_op.py index 8dbdd2921b9a0683b60ed1b1a133381db90c73c9..5b9e7bfe62b7f4804c49d43c449d7e3e366f4942 100644 --- a/python/paddle/fluid/tests/unittests/test_activation_op.py +++ b/python/paddle/fluid/tests/unittests/test_activation_op.py @@ -799,22 +799,15 @@ class TestLog1p(TestActivation): shape=[11, 17], append_batch_size=False, dtype="float64") - res_log1p = fluid.layers.data( - name="res_log1p", - shape=[11, 17], - append_batch_size=False, - dtype="float64") out1 = paddle.log1p(data_x) - out2 = paddle.log1p(data_x, out=res_log1p) exe = fluid.Executor(place=fluid.CPUPlace()) exe.run(fluid.default_startup_program()) - res1, res_in = exe.run(fluid.default_main_program(), - feed={"data_x": input_x}, - fetch_list=[out1, res_log1p]) + res1 = exe.run(fluid.default_main_program(), + feed={"data_x": input_x}, + fetch_list=[out1]) expected_res = np.log1p(input_x) - np.testing.assert_allclose(res1, expected_res) - np.testing.assert_allclose(res_in, expected_res) + self.assertTrue(np.allclose(res1, expected_res)) # dygraph with fluid.dygraph.guard(): @@ -823,7 +816,7 @@ class TestLog1p(TestActivation): z = paddle.log1p(data_x) np_z = z.numpy() z_expected = np.array(np.log1p(np_x)) - np.testing.assert_allclose(np_z, z_expected) + self.assertTrue(np.allclose(np_z, z_expected)) class TestSquare(TestActivation): diff --git a/python/paddle/fluid/tests/unittests/test_mul_op.py b/python/paddle/fluid/tests/unittests/test_mul_op.py index 4f2466c9b70426d81e28feedd278647b1201f834..8ca06aa952184daec6be59a09330c8f16f6ee1d6 100644 --- a/python/paddle/fluid/tests/unittests/test_mul_op.py +++ b/python/paddle/fluid/tests/unittests/test_mul_op.py @@ -175,35 +175,5 @@ class TestFP16MulOp2(TestMulOp2): no_grad_set=set('Y')) -class TestMulOpAttr(unittest.TestCase): - def test_out(self): - with fluid.program_guard(fluid.Program()): - x = fluid.data(name="x", shape=[2, 3], dtype="float32") - y = fluid.data(name='y', shape=[3, 2], dtype='float32') - - res = fluid.data(name="output", shape=[2, 2], dtype="float32") - y_1 = paddle.mul(x, y, out=res) - - place = fluid.CPUPlace() - exe = fluid.Executor(place) - data1 = np.array([[1, 2, 3], [4, 5, 6]], dtype='float32') - data2 = np.array([[1, 2], [1, 2], [1, 2]], dtype='float32') - 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) - - def test_name(self): - with fluid.program_guard(fluid.Program()): - x = fluid.data(name="x", shape=[2, 3], dtype="float32") - y = fluid.data(name='y', shape=[3, 2], dtype='float32') - - res = fluid.data(name="output", shape=[2, 2], dtype="float32") - y_1 = paddle.mul(x, y, name='mul_res') - y_2 = paddle.mul(x, y, out=res, name='mul_res') - self.assertEqual(('mul_res' in y_1.name), True) - - if __name__ == "__main__": unittest.main()