1717
1818import paddle
1919import paddle .vision .transforms as transforms
20- from paddle .fluid .framework import _test_eager_guard
2120from paddle .io import Dataset
2221
2322
2423class TestDatasetAbstract (unittest .TestCase ):
25- def func_test_main (self ):
24+ def test_main (self ):
2625 dataset = Dataset ()
2726 try :
2827 d = dataset [0 ]
@@ -36,11 +35,6 @@ def func_test_main(self):
3635 except NotImplementedError :
3736 pass
3837
39- def test_main (self ):
40- with _test_eager_guard ():
41- self .func_test_main ()
42- self .func_test_main ()
43-
4438
4539class TestDatasetWithDiffOutputPlace (unittest .TestCase ):
4640 def get_dataloader (self , num_workers ):
@@ -68,7 +62,7 @@ def run_check_on_cpu(self):
6862 self .assertTrue (label .place .is_cpu_place ())
6963 break
7064
71- def func_test_single_process (self ):
65+ def test_single_process (self ):
7266 self .run_check_on_cpu ()
7367 if paddle .is_compiled_with_cuda ():
7468 # Get (image, label) tuple from MNIST dataset
@@ -80,12 +74,7 @@ def func_test_single_process(self):
8074 self .assertTrue (label .place .is_cuda_pinned_place ())
8175 break
8276
83- def test_single_process (self ):
84- with _test_eager_guard ():
85- self .func_test_single_process ()
86- self .func_test_single_process ()
87-
88- def func_test_multi_process (self ):
77+ def test_multi_process (self ):
8978 # DataLoader with multi-process mode is not supported on MacOs and Windows currently
9079 if sys .platform != 'darwin' and sys .platform != 'win32' :
9180 self .run_check_on_cpu ()
@@ -99,11 +88,6 @@ def func_test_multi_process(self):
9988 self .assertTrue (label .place .is_cuda_pinned_place ())
10089 break
10190
102- def test_multi_process (self ):
103- with _test_eager_guard ():
104- self .func_test_multi_process ()
105- self .func_test_multi_process ()
106-
10791
10892if __name__ == '__main__' :
10993 unittest .main ()
0 commit comments