提交 e878960d authored 作者: Razvan Pascanu's avatar Razvan Pascanu

fix tests to assert correctly ( this are now tests for the bug in scan as a

while)
上级 6455a8dc
...@@ -2318,7 +2318,8 @@ class T_Scan(unittest.TestCase): ...@@ -2318,7 +2318,8 @@ class T_Scan(unittest.TestCase):
vx = numpy.zeros((50,), dtype = theano.config.floatX) vx = numpy.zeros((50,), dtype = theano.config.floatX)
vx[23] = 4 vx[23] = 4
out = f(vx) out = f(vx)
assert numpy.sum(out[24:]) == 0 assert len(out) == 24
def test_while1(self): def test_while1(self):
x = tensor.vector('x') x = tensor.vector('x')
...@@ -2332,7 +2333,8 @@ class T_Scan(unittest.TestCase): ...@@ -2332,7 +2333,8 @@ class T_Scan(unittest.TestCase):
vx = numpy.zeros((50,), dtype = theano.config.floatX) vx = numpy.zeros((50,), dtype = theano.config.floatX)
vx[23] = 4 vx[23] = 4
out, out2 = f(vx) out, out2 = f(vx)
assert numpy.sum(out[24:]) == 0 print 'len_out', len(out)
assert len(out) == 24
assert numpy.all(out2 == vx + 2) assert numpy.all(out2 == vx + 2)
lssc = [x for x in f.maker.env.toposort() lssc = [x for x in f.maker.env.toposort()
if isinstance(x.op, theano.scan_module.scan_op.Scan)] if isinstance(x.op, theano.scan_module.scan_op.Scan)]
...@@ -2351,8 +2353,8 @@ class T_Scan(unittest.TestCase): ...@@ -2351,8 +2353,8 @@ class T_Scan(unittest.TestCase):
vx = numpy.zeros((50,), dtype = theano.config.floatX) vx = numpy.zeros((50,), dtype = theano.config.floatX)
vx[23] = 4 vx[23] = 4
out, out2 = f(vx) out, out2 = f(vx)
assert numpy.sum(out[24:]) == 0 assert len(out) == 24
assert numpy.sum(out2[24:]) == 0 assert len(out2) == 24
lssc = [x for x in f.maker.env.toposort() lssc = [x for x in f.maker.env.toposort()
if isinstance(x.op, theano.scan_module.scan_op.Scan)] if isinstance(x.op, theano.scan_module.scan_op.Scan)]
assert len(lssc) == 1 assert len(lssc) == 1
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论