提交 3ee7720a authored 作者: Frederic's avatar Frederic

pep8

上级 b9daa6b9
...@@ -73,6 +73,7 @@ def may_fail(msg, EClass): ...@@ -73,6 +73,7 @@ def may_fail(msg, EClass):
return wrapper return wrapper
return test_decorator return test_decorator
def inplace_func(inputs, outputs, mode=None, allow_input_downcast=False, def inplace_func(inputs, outputs, mode=None, allow_input_downcast=False,
on_unused_input='raise', name=None): on_unused_input='raise', name=None):
if mode is None: if mode is None:
...@@ -93,6 +94,7 @@ def fake_shared(value, name=None, strict=False, allow_downcast=None, **kwargs): ...@@ -93,6 +94,7 @@ def fake_shared(value, name=None, strict=False, allow_downcast=None, **kwargs):
except TypeError: except TypeError:
continue continue
def rand_gpuarray(*shape, **kwargs): def rand_gpuarray(*shape, **kwargs):
r = rng.rand(*shape) * 2 - 1 r = rng.rand(*shape) * 2 - 1
dtype = kwargs.pop('dtype', theano.config.floatX) dtype = kwargs.pop('dtype', theano.config.floatX)
...@@ -231,8 +233,8 @@ def test_transfer_strided(): ...@@ -231,8 +233,8 @@ def test_transfer_strided():
av = numpy.asarray(rng.rand(5, 8), dtype='float32') av = numpy.asarray(rng.rand(5, 8), dtype='float32')
gv = gpuarray.array(av) gv = gpuarray.array(av)
av = av[:,::2] av = av[:, ::2]
gv = gv[:,::2] gv = gv[:, ::2]
f = theano.function([a], gpu_from_host(a)) f = theano.function([a], gpu_from_host(a))
fv = f(av) fv = f(av)
...@@ -247,7 +249,7 @@ def test_transfer_strided(): ...@@ -247,7 +249,7 @@ def test_transfer_strided():
"that the tests will be run this way", ValueError) "that the tests will be run this way", ValueError)
def test_transfer_cuda_gpu(): def test_transfer_cuda_gpu():
import theano.sandbox.cuda as cuda_ndarray import theano.sandbox.cuda as cuda_ndarray
if cuda_ndarray.cuda_available == False: if cuda_ndarray.cuda_available is False:
raise SkipTest("Can't test interaction with cuda if cuda not present") raise SkipTest("Can't test interaction with cuda if cuda not present")
g = GpuArrayType(dtype='float32', broadcastable=(False, False))('g') g = GpuArrayType(dtype='float32', broadcastable=(False, False))('g')
c = cuda_ndarray.CudaNdarrayType((False, False))('c') c = cuda_ndarray.CudaNdarrayType((False, False))('c')
...@@ -255,8 +257,8 @@ def test_transfer_cuda_gpu(): ...@@ -255,8 +257,8 @@ def test_transfer_cuda_gpu():
av = theano._asarray(rng.rand(5, 4), dtype='float32') av = theano._asarray(rng.rand(5, 4), dtype='float32')
gv = gpuarray.array(av) gv = gpuarray.array(av)
cv = cuda_ndarray.CudaNdarray(av) cv = cuda_ndarray.CudaNdarray(av)
gvs = gv[:,::-2] gvs = gv[:, ::-2]
cvs = cv[:,::-2] cvs = cv[:, ::-2]
f = theano.function([c], gpu_from_cuda(c)) f = theano.function([c], gpu_from_cuda(c))
fv = f(cv) fv = f(cv)
...@@ -429,7 +431,8 @@ def test_hostfromgpu_shape_i(): ...@@ -429,7 +431,8 @@ def test_hostfromgpu_shape_i():
""" """
m = mode_with_gpu.including('local_dot_to_dot22', m = mode_with_gpu.including('local_dot_to_dot22',
'local_dot22_to_dot22scalar','specialize') 'local_dot22_to_dot22scalar',
'specialize')
a = T.fmatrix('a') a = T.fmatrix('a')
ca = theano.sandbox.gpuarray.type.GpuArrayType('float32', (False, False))() ca = theano.sandbox.gpuarray.type.GpuArrayType('float32', (False, False))()
av = numpy.asarray(numpy.random.rand(5, 4), dtype='float32') av = numpy.asarray(numpy.random.rand(5, 4), dtype='float32')
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论