17
17
18
18
import paddle
19
19
import paddle .vision .transforms as transforms
20
- from paddle .fluid .framework import _test_eager_guard
21
20
from paddle .io import Dataset
22
21
23
22
24
23
class TestDatasetAbstract (unittest .TestCase ):
25
- def func_test_main (self ):
24
+ def test_main (self ):
26
25
dataset = Dataset ()
27
26
try :
28
27
d = dataset [0 ]
@@ -36,11 +35,6 @@ def func_test_main(self):
36
35
except NotImplementedError :
37
36
pass
38
37
39
- def test_main (self ):
40
- with _test_eager_guard ():
41
- self .func_test_main ()
42
- self .func_test_main ()
43
-
44
38
45
39
class TestDatasetWithDiffOutputPlace (unittest .TestCase ):
46
40
def get_dataloader (self , num_workers ):
@@ -68,7 +62,7 @@ def run_check_on_cpu(self):
68
62
self .assertTrue (label .place .is_cpu_place ())
69
63
break
70
64
71
- def func_test_single_process (self ):
65
+ def test_single_process (self ):
72
66
self .run_check_on_cpu ()
73
67
if paddle .is_compiled_with_cuda ():
74
68
# Get (image, label) tuple from MNIST dataset
@@ -80,12 +74,7 @@ def func_test_single_process(self):
80
74
self .assertTrue (label .place .is_cuda_pinned_place ())
81
75
break
82
76
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 ):
89
78
# DataLoader with multi-process mode is not supported on MacOs and Windows currently
90
79
if sys .platform != 'darwin' and sys .platform != 'win32' :
91
80
self .run_check_on_cpu ()
@@ -99,11 +88,6 @@ def func_test_multi_process(self):
99
88
self .assertTrue (label .place .is_cuda_pinned_place ())
100
89
break
101
90
102
- def test_multi_process (self ):
103
- with _test_eager_guard ():
104
- self .func_test_multi_process ()
105
- self .func_test_multi_process ()
106
-
107
91
108
92
if __name__ == '__main__' :
109
93
unittest .main ()
0 commit comments