File tree Expand file tree Collapse file tree 1 file changed +3
-10
lines changed Expand file tree Collapse file tree 1 file changed +3
-10
lines changed Original file line number Diff line number Diff line change 1414import unittest
1515
1616import numpy as np
17+ from op_test import get_device_place
1718
1819import paddle
19- from paddle .base import core
2020
2121
2222class TestPaddleAddNewFeatures (unittest .TestCase ):
2323 def setUp (self ):
2424 self .x_np = np .array ([3 , 5 ], dtype = 'float32' )
2525 self .y_np = np .array ([2 , 3 ], dtype = 'float32' )
2626 self .scalar = 2.0
27- self .place = (
28- core .CUDAPlace (0 )
29- if core .is_compiled_with_cuda ()
30- else core .CPUPlace ()
31- )
27+ self .place = get_device_place ()
3228
3329 def test_paddle_add_with_alpha (self ):
3430 """test paddle.add alpha"""
@@ -184,10 +180,7 @@ def test_param_alias_input_other(self):
184180class TestAddOut (unittest .TestCase ):
185181 def setUp (self ):
186182 paddle .disable_static ()
187- if core .is_compiled_with_cuda ():
188- self .place = core .CUDAPlace (0 )
189- else :
190- self .place = core .CPUPlace ()
183+ self .place = get_device_place ()
191184
192185 def test_add_with_alpha_out (self ):
193186 def run_add_with_alpha (test_type ):
You can’t perform that action at this time.
0 commit comments