diff --git a/python/paddle/fluid/tests/unittests/test_dataloader_dataset.py b/python/paddle/fluid/tests/unittests/test_dataloader_dataset.py index b174fd67b5872725632cc7834519e5c0059adf93..a0f14d1b93530789cc775f30f491862ee6bd8cc9 100644 --- a/python/paddle/fluid/tests/unittests/test_dataloader_dataset.py +++ b/python/paddle/fluid/tests/unittests/test_dataloader_dataset.py @@ -17,12 +17,11 @@ import unittest import paddle import paddle.vision.transforms as transforms -from paddle.fluid.framework import _test_eager_guard from paddle.io import Dataset class TestDatasetAbstract(unittest.TestCase): - def func_test_main(self): + def test_main(self): dataset = Dataset() try: d = dataset[0] @@ -36,11 +35,6 @@ class TestDatasetAbstract(unittest.TestCase): except NotImplementedError: pass - def test_main(self): - with _test_eager_guard(): - self.func_test_main() - self.func_test_main() - class TestDatasetWithDiffOutputPlace(unittest.TestCase): def get_dataloader(self, num_workers): @@ -68,7 +62,7 @@ class TestDatasetWithDiffOutputPlace(unittest.TestCase): self.assertTrue(label.place.is_cpu_place()) break - def func_test_single_process(self): + def test_single_process(self): self.run_check_on_cpu() if paddle.is_compiled_with_cuda(): # Get (image, label) tuple from MNIST dataset @@ -80,12 +74,7 @@ class TestDatasetWithDiffOutputPlace(unittest.TestCase): self.assertTrue(label.place.is_cuda_pinned_place()) break - def test_single_process(self): - with _test_eager_guard(): - self.func_test_single_process() - self.func_test_single_process() - - def func_test_multi_process(self): + def test_multi_process(self): # DataLoader with multi-process mode is not supported on MacOs and Windows currently if sys.platform != 'darwin' and sys.platform != 'win32': self.run_check_on_cpu() @@ -99,11 +88,6 @@ class TestDatasetWithDiffOutputPlace(unittest.TestCase): self.assertTrue(label.place.is_cuda_pinned_place()) break - def test_multi_process(self): - with _test_eager_guard(): - self.func_test_multi_process() - self.func_test_multi_process() - if __name__ == '__main__': unittest.main() diff --git a/python/paddle/fluid/tests/unittests/test_deform_conv2d.py b/python/paddle/fluid/tests/unittests/test_deform_conv2d.py index 304fbcf80a4f5a39284d56dd56cced4d162007d8..7a5093f872ceda2e0e88095d873ab1a2df763ef4 100644 --- a/python/paddle/fluid/tests/unittests/test_deform_conv2d.py +++ b/python/paddle/fluid/tests/unittests/test_deform_conv2d.py @@ -19,7 +19,6 @@ import numpy as np import paddle import paddle.nn.initializer as I -from paddle.fluid.framework import _test_eager_guard class TestDeformConv2D(TestCase): @@ -233,10 +232,6 @@ class TestDeformConv2D(TestCase): self.place = paddle.CUDAPlace(0) self._test_identity() - def test_identity_with_eager_guard(self): - with _test_eager_guard(): - self.test_identity() - class TestDeformConv2DFunctional(TestCase): batch_size = 4 @@ -544,10 +539,6 @@ class TestDeformConv2DFunctional(TestCase): self.place = paddle.CUDAPlace(0) self._test_identity() - def test_identity_with_eager_guard(self): - with _test_eager_guard(): - self.test_identity() - # testcases for DeformConv2D class TestDeformConv2DWithPadding(TestDeformConv2D): diff --git a/python/paddle/fluid/tests/unittests/test_deformable_conv_op.py b/python/paddle/fluid/tests/unittests/test_deformable_conv_op.py index 273eeeda28c23fff3087cdf11c001da7022bdabf..e3bc04d4146830197d3a7cb461751dd4a71aface 100644 --- a/python/paddle/fluid/tests/unittests/test_deformable_conv_op.py +++ b/python/paddle/fluid/tests/unittests/test_deformable_conv_op.py @@ -18,7 +18,6 @@ import numpy as np from op_test import OpTest import paddle -from paddle.fluid.framework import _test_eager_guard paddle.enable_static() @@ -442,10 +441,6 @@ class TestModulatedDeformableConvInvalidInput(unittest.TestCase): self.assertRaises(ValueError, test_invalid_filter) - def test_error_with_eager_guard(self): - with _test_eager_guard(): - self.test_error() - class TestDeformConv2DAPI(unittest.TestCase): def test_api(self): @@ -484,10 +479,6 @@ class TestDeformConv2DAPI(unittest.TestCase): test_deform_conv2d_v2() - def test_api_with_eager_guard(self): - with _test_eager_guard(): - self.test_api() - if __name__ == '__main__': unittest.main() diff --git a/python/paddle/fluid/tests/unittests/test_determinant_op.py b/python/paddle/fluid/tests/unittests/test_determinant_op.py index 7eff966e60d217bc616619b9063e0465d8b783ce..3ee49467626d009213146b6dec0e63b35fb7a15d 100644 --- a/python/paddle/fluid/tests/unittests/test_determinant_op.py +++ b/python/paddle/fluid/tests/unittests/test_determinant_op.py @@ -18,7 +18,6 @@ import numpy as np from op_test import OpTest import paddle -from paddle.fluid.framework import _test_eager_guard paddle.enable_static() @@ -87,10 +86,6 @@ class TestDeterminantAPI(unittest.TestCase): np.testing.assert_allclose(out.numpy(), out_ref, rtol=0.001) paddle.enable_static() - def test_eager(self): - with _test_eager_guard(): - self.test_api_dygraph() - class TestSlogDeterminantOp(OpTest): def setUp(self): diff --git a/python/paddle/fluid/tests/unittests/test_diag_v2.py b/python/paddle/fluid/tests/unittests/test_diag_v2.py index 9c96661f6c081ff4a6a1234f43cb9109e5ab55fd..fefdf613fc2423462273bfb9ca53cb3dc480491c 100644 --- a/python/paddle/fluid/tests/unittests/test_diag_v2.py +++ b/python/paddle/fluid/tests/unittests/test_diag_v2.py @@ -20,7 +20,6 @@ from op_test import OpTest import paddle import paddle.fluid as fluid from paddle.fluid import Program, program_guard -from paddle.fluid.framework import _test_eager_guard class TestDiagV2Op(OpTest): @@ -281,8 +280,6 @@ class TestDiagV2API(unittest.TestCase): def test_cpu(self): paddle.disable_static(place=paddle.fluid.CPUPlace()) self.run_imperative() - with _test_eager_guard(): - self.run_imperative() paddle.enable_static() @@ -295,8 +292,6 @@ class TestDiagV2API(unittest.TestCase): paddle.disable_static(place=paddle.fluid.CUDAPlace(0)) self.run_imperative() - with _test_eager_guard(): - self.run_imperative() paddle.enable_static() with fluid.program_guard(fluid.Program()): diff --git a/python/paddle/fluid/tests/unittests/test_diagonal_op.py b/python/paddle/fluid/tests/unittests/test_diagonal_op.py index cb35a3fce5d0307a0e12634e16c117591c633be9..e8666ed5147619770d2b64d2ff4b4ce885cc467c 100644 --- a/python/paddle/fluid/tests/unittests/test_diagonal_op.py +++ b/python/paddle/fluid/tests/unittests/test_diagonal_op.py @@ -18,7 +18,6 @@ import numpy as np from op_test import OpTest import paddle -from paddle.fluid.framework import _test_eager_guard paddle.enable_static() @@ -157,12 +156,11 @@ class TestDiagonalAPI(unittest.TestCase): def test_api_eager(self): paddle.disable_static(self.place) - with _test_eager_guard(): - x_tensor = paddle.to_tensor(self.x) - out = paddle.diagonal(x_tensor) - out2 = paddle.diagonal(x_tensor, offset=0, axis1=2, axis2=1) - out3 = paddle.diagonal(x_tensor, offset=1, axis1=0, axis2=1) - out4 = paddle.diagonal(x_tensor, offset=0, axis1=1, axis2=2) + x_tensor = paddle.to_tensor(self.x) + out = paddle.diagonal(x_tensor) + out2 = paddle.diagonal(x_tensor, offset=0, axis1=2, axis2=1) + out3 = paddle.diagonal(x_tensor, offset=1, axis1=0, axis2=1) + out4 = paddle.diagonal(x_tensor, offset=0, axis1=1, axis2=2) out_ref = np.diagonal(self.x) np.testing.assert_allclose(out.numpy(), out_ref, rtol=1e-08) out2_ref = np.diagonal(self.x, offset=0, axis1=2, axis2=1) @@ -174,10 +172,6 @@ class TestDiagonalAPI(unittest.TestCase): paddle.enable_static() - def test_api_eager_dygraph(self): - with _test_eager_guard(): - self.test_api_dygraph() - if __name__ == '__main__': unittest.main() diff --git a/python/paddle/fluid/tests/unittests/test_diff_op.py b/python/paddle/fluid/tests/unittests/test_diff_op.py index 7df3f779ffd847c65a3fa63e78da5cdb538d901f..b89f7759a73a6164f9dd2f5704d509ee5442cb53 100644 --- a/python/paddle/fluid/tests/unittests/test_diff_op.py +++ b/python/paddle/fluid/tests/unittests/test_diff_op.py @@ -19,7 +19,6 @@ import numpy as np import paddle import paddle.fluid as fluid import paddle.fluid.core as core -from paddle.fluid.framework import _test_eager_guard class TestDiffOp(unittest.TestCase): @@ -75,9 +74,6 @@ class TestDiffOp(unittest.TestCase): self.assertTrue((out.numpy() == self.output).all(), True) def test_dygraph(self): - with _test_eager_guard(): - self.setUp() - self.func_dygraph() self.setUp() self.func_dygraph() @@ -145,9 +141,6 @@ class TestDiffOp(unittest.TestCase): raise RuntimeError("Check Diff Gradient Failed") def test_grad(self): - with _test_eager_guard(): - self.setUp() - self.func_grad() self.setUp() self.func_grad() diff --git a/python/paddle/fluid/tests/unittests/test_digamma_op.py b/python/paddle/fluid/tests/unittests/test_digamma_op.py index 3f876085dfdfcc73b91b0c89254457a95c8d8fd4..10f0a420ed3b0dd5d521b3c8703d2946b91a5e14 100644 --- a/python/paddle/fluid/tests/unittests/test_digamma_op.py +++ b/python/paddle/fluid/tests/unittests/test_digamma_op.py @@ -21,7 +21,6 @@ from scipy.special import psi import paddle import paddle.fluid as fluid import paddle.static as static -from paddle.fluid.framework import _test_eager_guard class TestDigammaOp(OpTest): @@ -95,10 +94,6 @@ class TestDigammaAPI(unittest.TestCase): res = paddle.digamma(input_t).numpy() np.testing.assert_allclose(res, sc_res, rtol=1e-05) - def test_in_eager_dynamic_mode(self): - with _test_eager_guard(): - self.test_in_dynamic_mode() - def test_name_argument(self): with static.program_guard(static.Program()): x = static.data(name="x", shape=self._shape, dtype=self.dtypes[0]) @@ -119,13 +114,6 @@ class TestDigammaAPI(unittest.TestCase): input_t = paddle.to_tensor(input) res = paddle.digamma(input_t) - with self.assertRaises(RuntimeError): - with fluid.dygraph.guard(): - with _test_eager_guard(): - input = np.random.random(self._shape).astype("int32") - input_t = paddle.to_tensor(input) - res = paddle.digamma(input_t) - if __name__ == "__main__": unittest.main() diff --git a/python/paddle/fluid/tests/unittests/test_dist_base.py b/python/paddle/fluid/tests/unittests/test_dist_base.py index 57071583f1ed0d982a909d7996551682256f32af..a83c8206523e34a9bcb5af40cb16b95ad4481c78 100755 --- a/python/paddle/fluid/tests/unittests/test_dist_base.py +++ b/python/paddle/fluid/tests/unittests/test_dist_base.py @@ -30,7 +30,6 @@ import paddle.fluid as fluid import paddle.fluid.dygraph as dygraph import paddle.fluid.incubate.fleet.base.role_maker as role_maker from paddle.fluid import compiler -from paddle.fluid.framework import _test_eager_guard from paddle.fluid.incubate.fleet.collective import DistributedStrategy, fleet RUN_STEP = 5 @@ -1718,16 +1717,6 @@ class TestDistBase(unittest.TestCase): log_name="", ): if self._dygraph and (self._gloo_mode or self._nccl2_mode): - need_envs.update({"FLAGS_enable_eager_mode": "1"}) - with _test_eager_guard(): - self.check_with_place_func( - model_file=model_file, - delta=delta, - check_error_log=check_error_log, - need_envs=need_envs, - log_name=log_name, - ) - need_envs.update({"FLAGS_enable_eager_mode": "0"}) self.check_with_place_func( model_file=model_file, delta=delta, diff --git a/python/paddle/fluid/tests/unittests/test_dygraph_mnist_fp16.py b/python/paddle/fluid/tests/unittests/test_dygraph_mnist_fp16.py index 862b3868023ca502b24a8b91b75540336683c48d..9c0388d128dd92678506e5d664358a667f0c2759 100644 --- a/python/paddle/fluid/tests/unittests/test_dygraph_mnist_fp16.py +++ b/python/paddle/fluid/tests/unittests/test_dygraph_mnist_fp16.py @@ -18,7 +18,6 @@ import numpy as np import paddle import paddle.fluid as fluid -from paddle.fluid.framework import _test_eager_guard from paddle.nn import Linear @@ -136,8 +135,6 @@ class TestMnist(unittest.TestCase): print(loss.numpy()) def test_mnist_fp16(self): - with _test_eager_guard(): - self.func_mnist_fp16() self.func_mnist_fp16()