提交 5f08407d authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Whitespace

上级 f5ed1817
......@@ -945,4 +945,3 @@ class Test_aliasing_rules(unittest.TestCase):
if __name__ == '__main__':
theano.config.mode = 'FAST_COMPILE'
Test_pfunc().test_default_scalar_container()
......@@ -42,7 +42,7 @@ class Test_SharedVariable(unittest.TestCase):
# generic can hold anything even when strict=True
u = shared('asdf', strict=False)
v = shared('asdf', strict=True)
v = shared('asdf', strict=True)
u.set_value(88)
v.set_value(88)
......@@ -102,7 +102,7 @@ class Test_SharedVariable(unittest.TestCase):
assert numpy.all(u.get_value() == [3,4])
# check that assignments of nonsense fail
try:
try:
u.set_value('adsf')
assert 0
except ValueError:
......@@ -124,7 +124,7 @@ class Test_SharedVariable(unittest.TestCase):
b = shared(numpy.int32(7), strict=True)
assert b.type == theano.tensor.iscalar
self.failUnlessRaises(TypeError, f, b, 8.23)
b = shared(numpy.int16(7), strict=True)
assert b.type == theano.tensor.wscalar
self.failUnlessRaises(TypeError, f, b, 8.23)
......@@ -235,7 +235,7 @@ class Test_SharedVariable(unittest.TestCase):
assert b.type == theano.tensor.dscalar
f(b,8)
assert b.get_value()==8
b = shared(numpy.float32(7.234), allow_downcast=True)
assert b.type == theano.tensor.fscalar
f(b,8)
......@@ -307,6 +307,3 @@ class Test_SharedVariable(unittest.TestCase):
c = shared(numpy.zeros((5,5), dtype='float32'), allow_downcast=True)
self.failUnlessRaises(TypeError, f, b, numpy.random.rand(5,5))
......@@ -133,7 +133,7 @@ if 0:
dmatrix4 = tensor.TensorType("float32", (False, False, False, False))
b = dmatrix4()
f = pfunc([b], [a(b)], mode=mode_with_gpu)
bval = numpy.arange(0,d0*d1).reshape(1,1,d0,d1)
r = f(bval)[0]
# print bval, bval.shape, border
......@@ -143,7 +143,7 @@ if 0:
def test_downsample():
import random
shps = [ (1, 1, 1, 12),
(1, 1, 2, 2),
(1, 1, 2, 2),
(1, 1, 1, 1),
(1,1,4,4),
(1, 1, 10, 11),
......@@ -181,7 +181,7 @@ def test_downsample():
assert any([isinstance(node.op, tcn.blas.GpuDownsampleFactorMax) for node in
f.maker.env.toposort()])
assert numpy.allclose(f(),f2())
g = pfunc([], tensor.grad(ds_op(tensor.as_tensor_variable(a)).sum(),a), mode=mode_with_gpu)
g2 = pfunc([], tensor.grad(ds_op(tensor.as_tensor_variable(a)).sum(),a), mode=mode_without_gpu)
assert any([isinstance(node.op, tcn.blas.GpuDownsampleFactorMaxGrad)
......@@ -190,6 +190,3 @@ def test_downsample():
#We already check that the gpu version return the same value as the gpu version
#for GpuDownsampleFactorMaxGrad. So no need to call verify_grad here.
......@@ -61,7 +61,7 @@ class multiple_outputs_numeric_grad:
# something else ( a random state ? ) with which we shouldn't really
# mess up
if not ndarray_mask:
ndarray_mask = [True for x in pt ]
ndarray_mask = [True for x in pt ]
dtype_eps = multiple_outputs_numeric_grad.type_eps['float64']
......@@ -70,7 +70,7 @@ class multiple_outputs_numeric_grad:
pt[i] = numpy.array(p)
_eps = multiple_outputs_numeric_grad.type_eps[str(pt[i].dtype)]
if _eps > dtype_eps:
dtype_eps = _eps
dtype_eps = _eps
# Compute clean output:
......@@ -1050,7 +1050,7 @@ class T_Scan(unittest.TestCase):
f1 = theano.tensor.dscalar('f1')
def scanStep(prev, seq, f1):
return prev + f1 * seq
return prev + f1 * seq
scanned, _ = theano.scan(fn = scanStep, \
sequences = [seq], \
......@@ -1074,8 +1074,8 @@ class T_Scan(unittest.TestCase):
inpt = theano.tensor.matrix('inpt')
def one_step(x_t, h_tm1, W):
expr = T.dot(h_tm1, W) + x_t
return expr
expr = T.dot(h_tm1, W) + x_t
return expr
expr, _ = theano.scan(
fn=one_step,
......@@ -1114,7 +1114,7 @@ class T_Scan(unittest.TestCase):
floatX = theano.config.floatX
def one_step( h_tm1):
return h_tm1 + numpy.asarray(1., dtype=floatX)
return h_tm1 + numpy.asarray(1., dtype=floatX)
h, _ = theano.scan(
fn=one_step,
......@@ -1131,4 +1131,3 @@ class T_Scan(unittest.TestCase):
if __name__ == '__main__':
unittest.main()
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论