提交 17f9b00b authored 作者: Frederic Bastien's avatar Frederic Bastien

import theano_cuda_ndarray only when we ask for gpu test.

上级 9dd4459a
...@@ -792,7 +792,6 @@ def test_const_type_in_mul_canonizer(): ...@@ -792,7 +792,6 @@ def test_const_type_in_mul_canonizer():
from theano.compile.sandbox.pfunc import pfunc from theano.compile.sandbox.pfunc import pfunc
from theano.compile.sandbox.sharedvalue import shared from theano.compile.sandbox.sharedvalue import shared
import theano_cuda_ndarray as tcn
import theano import theano
class test_fusion(unittest.TestCase): class test_fusion(unittest.TestCase):
...@@ -933,6 +932,8 @@ class test_fusion(unittest.TestCase): ...@@ -933,6 +932,8 @@ class test_fusion(unittest.TestCase):
assert numpy.allclose(out,answer*nb_repeat,atol=1e-6 if out_dtype=='float32' else 1e-8) assert numpy.allclose(out,answer*nb_repeat,atol=1e-6 if out_dtype=='float32' else 1e-8)
topo=f.maker.env.toposort() topo=f.maker.env.toposort()
if gpu: if gpu:
import theano_cuda_ndarray as tcn
topo = [x for x in topo if not isinstance(x.op,tcn.basic_ops.GpuFromHost)] topo = [x for x in topo if not isinstance(x.op,tcn.basic_ops.GpuFromHost)]
gpu_ = [x for x in topo if isinstance(x.op,tcn.basic_ops.GpuFromHost)] gpu_ = [x for x in topo if isinstance(x.op,tcn.basic_ops.GpuFromHost)]
assert len(gpu_)==len(sym_inputs) assert len(gpu_)==len(sym_inputs)
...@@ -958,6 +959,7 @@ class test_fusion(unittest.TestCase): ...@@ -958,6 +959,7 @@ class test_fusion(unittest.TestCase):
mode=compile.mode.predefined_modes['FAST_COMPILE'] mode=compile.mode.predefined_modes['FAST_COMPILE']
mode=compile.mode.predefined_modes['FAST_RUN'] mode=compile.mode.predefined_modes['FAST_RUN']
mode=compile.mode.predefined_modes['DEBUG_MODE'] mode=compile.mode.predefined_modes['DEBUG_MODE']
import theano_cuda_ndarray as tcn
self.do(mode, tcn.shared_constructor, shp, gpu=True) self.do(mode, tcn.shared_constructor, shp, gpu=True)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论