提交 74421e0b authored 作者: amrithasuresh's avatar amrithasuresh

fixed indentation

上级 d464ec4c
...@@ -231,13 +231,13 @@ class test_ifelse(unittest.TestCase, utt.TestOptimizationMixin): ...@@ -231,13 +231,13 @@ class test_ifelse(unittest.TestCase, utt.TestOptimizationMixin):
def test_multiple_out_crash(self): def test_multiple_out_crash(self):
# This test failed up to commit 2faeb62c38 # This test failed up to commit 2faeb62c38
p0 = self.shared(np.asarray(np.random.random([4, 8]), p0 = self.shared(np.asarray(np.random.random([4, 8]),
dtype=self.dtype)) dtype=self.dtype))
p1 = self.shared(np.asarray(np.random.random(8), p1 = self.shared(np.asarray(np.random.random(8),
dtype=self.dtype)) dtype=self.dtype))
p2 = self.shared(np.asarray(np.random.random([8, 3]), p2 = self.shared(np.asarray(np.random.random([8, 3]),
dtype=self.dtype)) dtype=self.dtype))
p3 = self.shared(np.asarray(np.random.random(3), p3 = self.shared(np.asarray(np.random.random(3),
dtype=self.dtype)) dtype=self.dtype))
p = [p0, p1, p2, p3] p = [p0, p1, p2, p3]
# in my code these vars are the result of applying scan # in my code these vars are the result of applying scan
...@@ -384,9 +384,9 @@ class test_ifelse(unittest.TestCase, utt.TestOptimizationMixin): ...@@ -384,9 +384,9 @@ class test_ifelse(unittest.TestCase, utt.TestOptimizationMixin):
vw2 = rng.uniform() vw2 = rng.uniform()
assert np.allclose(f(vx1, vx2, vy1, vy2, vw1, vw2, 1), assert np.allclose(f(vx1, vx2, vy1, vy2, vw1, vw2, 1),
vx1 * vy1 * vw1) vx1 * vy1 * vw1)
assert np.allclose(f(vx1, vx2, vy1, vy2, vw1, vw2, 0), assert np.allclose(f(vx1, vx2, vy1, vy2, vw1, vw2, 0),
vx2 * vy2 * vw2) vx2 * vy2 * vw2)
def test_pushout3(self): def test_pushout3(self):
raise SkipTest("Optimization temporarily disabled") raise SkipTest("Optimization temporarily disabled")
...@@ -440,14 +440,14 @@ class test_ifelse(unittest.TestCase, utt.TestOptimizationMixin): ...@@ -440,14 +440,14 @@ class test_ifelse(unittest.TestCase, utt.TestOptimizationMixin):
else: else:
vw = vw2 vw = vw2
assert np.allclose(f(vx1, vx2, vy1, vy2, vw1, vw2, 1), assert np.allclose(f(vx1, vx2, vy1, vy2, vw1, vw2, 1),
vx1 * vy1 * vw) vx1 * vy1 * vw)
if vx2 > vy2: if vx2 > vy2:
vw = vw1 vw = vw1
else: else:
vw = vw2 vw = vw2
assert np.allclose(f(vx1, vx2, vy1, vy2, vw1, vw2, 0), assert np.allclose(f(vx1, vx2, vy1, vy2, vw1, vw2, 0),
vx2 * vy2 * vw) vx2 * vy2 * vw)
def test_merge_ifs_true_false(self): def test_merge_ifs_true_false(self):
raise SkipTest("Optimization temporarily disabled") raise SkipTest("Optimization temporarily disabled")
...@@ -475,9 +475,9 @@ class test_ifelse(unittest.TestCase, utt.TestOptimizationMixin): ...@@ -475,9 +475,9 @@ class test_ifelse(unittest.TestCase, utt.TestOptimizationMixin):
vw1 = rng.uniform() vw1 = rng.uniform()
vw2 = rng.uniform() vw2 = rng.uniform()
assert np.allclose(f(vx1, vx2, vy1, vy2, vw1, vw2, 1), assert np.allclose(f(vx1, vx2, vy1, vy2, vw1, vw2, 1),
vx1 + vy1 + vw1) vx1 + vy1 + vw1)
assert np.allclose(f(vx1, vx2, vy1, vy2, vw1, vw2, 0), assert np.allclose(f(vx1, vx2, vy1, vy2, vw1, vw2, 0),
vx2 + vy2 + vw2) vx2 + vy2 + vw2)
def test_grad_test_values(self): def test_grad_test_values(self):
""" """
......
...@@ -104,9 +104,9 @@ class RopLop_checker(unittest.TestCase): ...@@ -104,9 +104,9 @@ class RopLop_checker(unittest.TestCase):
after the Op you want to test. after the Op you want to test.
""" """
vx = np.asarray(self.rng.uniform(size=self.mat_in_shape), vx = np.asarray(self.rng.uniform(size=self.mat_in_shape),
theano.config.floatX) theano.config.floatX)
vv = np.asarray(self.rng.uniform(size=self.mat_in_shape), vv = np.asarray(self.rng.uniform(size=self.mat_in_shape),
theano.config.floatX) theano.config.floatX)
yv = tensor.Rop(y, self.mx, self.mv) yv = tensor.Rop(y, self.mx, self.mv)
rop_f = function([self.mx, self.mv], yv, on_unused_input='ignore') rop_f = function([self.mx, self.mv], yv, on_unused_input='ignore')
sy, _ = theano.scan(lambda i, y, x, v: sy, _ = theano.scan(lambda i, y, x, v:
...@@ -141,9 +141,9 @@ class RopLop_checker(unittest.TestCase): ...@@ -141,9 +141,9 @@ class RopLop_checker(unittest.TestCase):
""" """
# TEST ROP # TEST ROP
vx = np.asarray(self.rng.uniform(size=self.in_shape), vx = np.asarray(self.rng.uniform(size=self.in_shape),
theano.config.floatX) theano.config.floatX)
vv = np.asarray(self.rng.uniform(size=self.in_shape), vv = np.asarray(self.rng.uniform(size=self.in_shape),
theano.config.floatX) theano.config.floatX)
yv = tensor.Rop(y, self.x, self.v) yv = tensor.Rop(y, self.x, self.v)
rop_f = function([self.x, self.v], yv, on_unused_input='ignore') rop_f = function([self.x, self.v], yv, on_unused_input='ignore')
...@@ -166,9 +166,9 @@ class RopLop_checker(unittest.TestCase): ...@@ -166,9 +166,9 @@ class RopLop_checker(unittest.TestCase):
# TEST LOP # TEST LOP
vx = np.asarray(self.rng.uniform(size=self.in_shape), vx = np.asarray(self.rng.uniform(size=self.in_shape),
theano.config.floatX) theano.config.floatX)
vv = np.asarray(self.rng.uniform(size=out_shape), vv = np.asarray(self.rng.uniform(size=out_shape),
theano.config.floatX) theano.config.floatX)
yv = tensor.Lop(y, self.x, self.v) yv = tensor.Lop(y, self.x, self.v)
lop_f = function([self.x, self.v], yv, on_unused_input='ignore') lop_f = function([self.x, self.v], yv, on_unused_input='ignore')
...@@ -214,21 +214,21 @@ class test_RopLop(RopLop_checker): ...@@ -214,21 +214,21 @@ class test_RopLop(RopLop_checker):
def test_incsubtensor1(self): def test_incsubtensor1(self):
tv = np.asarray(self.rng.uniform(size=(3,)), tv = np.asarray(self.rng.uniform(size=(3,)),
theano.config.floatX) theano.config.floatX)
t = theano.shared(tv) t = theano.shared(tv)
out = tensor.inc_subtensor(self.x[:3], t) out = tensor.inc_subtensor(self.x[:3], t)
self.check_rop_lop(out, self.in_shape) self.check_rop_lop(out, self.in_shape)
def test_incsubtensor2(self): def test_incsubtensor2(self):
tv = np.asarray(self.rng.uniform(size=(10,)), tv = np.asarray(self.rng.uniform(size=(10,)),
theano.config.floatX) theano.config.floatX)
t = theano.shared(tv) t = theano.shared(tv)
out = tensor.inc_subtensor(t[:4], self.x[:4]) out = tensor.inc_subtensor(t[:4], self.x[:4])
self.check_rop_lop(out, (10,)) self.check_rop_lop(out, (10,))
def test_setsubtensor1(self): def test_setsubtensor1(self):
tv = np.asarray(self.rng.uniform(size=(3,)), tv = np.asarray(self.rng.uniform(size=(3,)),
theano.config.floatX) theano.config.floatX)
t = theano.shared(tv) t = theano.shared(tv)
out = tensor.set_subtensor(self.x[:3], t) out = tensor.set_subtensor(self.x[:3], t)
self.check_rop_lop(out, self.in_shape) self.check_rop_lop(out, self.in_shape)
...@@ -239,7 +239,7 @@ class test_RopLop(RopLop_checker): ...@@ -239,7 +239,7 @@ class test_RopLop(RopLop_checker):
def test_setsubtensor2(self): def test_setsubtensor2(self):
tv = np.asarray(self.rng.uniform(size=(10,)), tv = np.asarray(self.rng.uniform(size=(10,)),
theano.config.floatX) theano.config.floatX)
t = theano.shared(tv) t = theano.shared(tv)
out = tensor.set_subtensor(t[:4], self.x[:4]) out = tensor.set_subtensor(t[:4], self.x[:4])
self.check_rop_lop(out, (10,)) self.check_rop_lop(out, (10,))
...@@ -347,7 +347,7 @@ class test_RopLop(RopLop_checker): ...@@ -347,7 +347,7 @@ class test_RopLop(RopLop_checker):
def test_join(self): def test_join(self):
tv = np.asarray(self.rng.uniform(size=(10,)), tv = np.asarray(self.rng.uniform(size=(10,)),
theano.config.floatX) theano.config.floatX)
t = theano.shared(tv) t = theano.shared(tv)
out = tensor.join(0, self.x, t) out = tensor.join(0, self.x, t)
self.check_rop_lop(out, (self.in_shape[0] + 10,)) self.check_rop_lop(out, (self.in_shape[0] + 10,))
...@@ -355,7 +355,7 @@ class test_RopLop(RopLop_checker): ...@@ -355,7 +355,7 @@ class test_RopLop(RopLop_checker):
def test_dot(self): def test_dot(self):
insh = self.in_shape[0] insh = self.in_shape[0]
vW = np.asarray(self.rng.uniform(size=(insh, insh)), vW = np.asarray(self.rng.uniform(size=(insh, insh)),
theano.config.floatX) theano.config.floatX)
W = theano.shared(vW) W = theano.shared(vW)
self.check_rop_lop(tensor.dot(self.x, W), self.in_shape) self.check_rop_lop(tensor.dot(self.x, W), self.in_shape)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论