fix unittest-error: test_network_with_dtype

testDrivenImageClassification
Luo Tao 8 years ago
parent 18f527bfa3
commit f60b9a4208

@ -24,7 +24,7 @@ BATCH_SIZE = 20
class TestNetWithDtype(unittest.TestCase): class TestNetWithDtype(unittest.TestCase):
def setUp(self): def set_network(self):
self.dtype = "float64" self.dtype = "float64"
self.init_dtype() self.init_dtype()
self.x = fluid.layers.data(name='x', shape=[13], dtype=self.dtype) self.x = fluid.layers.data(name='x', shape=[13], dtype=self.dtype)
@ -55,12 +55,14 @@ class TestNetWithDtype(unittest.TestCase):
pass pass
def test_cpu(self): def test_cpu(self):
self.set_network()
place = fluid.CPUPlace() place = fluid.CPUPlace()
self.run_net_on_place(place) self.run_net_on_place(place)
def test_gpu(self): def test_gpu(self):
if not core.is_compiled_with_cuda(): if not core.is_compiled_with_cuda():
return return
self.set_network()
place = fluid.CUDAPlace(0) place = fluid.CUDAPlace(0)
self.run_net_on_place(place) self.run_net_on_place(place)

Loading…
Cancel
Save