提交 868dd694 authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Some pep8

上级 e4533cec
import logging import logging
import unittest
from nose.plugins.skip import SkipTest from nose.plugins.skip import SkipTest
import numpy import numpy
...@@ -10,11 +9,10 @@ from theano.compat.six import StringIO ...@@ -10,11 +9,10 @@ from theano.compat.six import StringIO
from theano.gof.python25 import any from theano.gof.python25 import any
import theano.tensor as T import theano.tensor as T
import theano.tests.unittest_tools as utt import theano.tests.unittest_tools as utt
from theano.sandbox.neighbours import images2neibs, neibs2images from theano.sandbox.neighbours import images2neibs
from theano.tensor.signal.downsample import max_pool_2d from theano.tensor.signal.downsample import max_pool_2d
from theano.tensor.signal.downsample import DownsampleFactorMaxGrad from theano.tensor.signal.downsample import DownsampleFactorMaxGrad
import theano.sandbox.cuda.dnn as dnn import theano.sandbox.cuda.dnn as dnn
from theano.sandbox.cuda.basic_ops import gpu_contiguous
# Skip test if cuda_ndarray is not available. # Skip test if cuda_ndarray is not available.
import theano.sandbox.cuda as cuda import theano.sandbox.cuda as cuda
...@@ -70,8 +68,8 @@ def test_pooling(): ...@@ -70,8 +68,8 @@ def test_pooling():
raise SkipTest(cuda.dnn.dnn_available.msg) raise SkipTest(cuda.dnn.dnn_available.msg)
x = T.ftensor4() x = T.ftensor4()
for func, pad in product( for func, pad in product((T.max, T.mean),
(T.max, T.mean), ((0, 0), (1, 0), (1, 0), (2, 3), (3, 2))): ((0, 0), (1, 0), (1, 0), (2, 3), (3, 2))):
if pad != (0, 0) and cuda.dnn.version() < 20: if pad != (0, 0) and cuda.dnn.version() < 20:
continue continue
...@@ -104,7 +102,7 @@ def test_pooling(): ...@@ -104,7 +102,7 @@ def test_pooling():
for shp in [(1, 10, 100, 100), for shp in [(1, 10, 100, 100),
(1, 3, 99, 99), (1, 3, 99, 99),
(32, 1, 147, 197), (32, 1, 147, 197),
]: ]:
print func, pad, ws, stride, shp print func, pad, ws, stride, shp
data = numpy.random.normal(0, 1, shp).astype("float32") data = numpy.random.normal(0, 1, shp).astype("float32")
...@@ -193,7 +191,7 @@ def test_pooling_opt(): ...@@ -193,7 +191,7 @@ def test_pooling_opt():
def test_dnn_tag(): def test_dnn_tag():
""" """
We test that if cudnn isn't avail we crash and that if it is avail, we use it. Test that if cudnn isn't avail we crash and that if it is avail, we use it.
""" """
x = T.ftensor4() x = T.ftensor4()
old = theano.config.on_opt_error old = theano.config.on_opt_error
...@@ -440,11 +438,11 @@ class TestDnnInferShapes(utt.InferShapeTester): ...@@ -440,11 +438,11 @@ class TestDnnInferShapes(utt.InferShapeTester):
mode=params[2] mode=params[2]
)() )()
pool_grad = dnn.GpuDnnPoolGrad()( pool_grad = dnn.GpuDnnPoolGrad()(
img, img,
out, out,
img_grad, img_grad,
desc desc
) )
self._compile_and_check( self._compile_and_check(
[img, img_grad, out], [img, img_grad, out],
[pool_grad], [pool_grad],
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论