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

Test for the infer shape (I couldn't see one in the list of tests)

上级 f4b707da
...@@ -2519,6 +2519,22 @@ class T_Scan(unittest.TestCase): ...@@ -2519,6 +2519,22 @@ class T_Scan(unittest.TestCase):
out = f(vx) out = f(vx)
assert out == 24 assert out == 24
def test_infershape_nsteps_smaller_seq_length(self):
x = tensor.vector('x')
o, _ = theano.scan(lambda x: x+1,
sequences = x,
outputs_info = [None],
n_steps = 20)
f = theano.function([x], o.shape[0], mode = mode_with_opt)
vx = numpy.ones((30,), dtype = theano.config.floatX)
out = f(vx)
assert out == 20
lssc = [x for x in f.maker.env.toposort()
if isinstance(x.op, theano.scan_module.scan_op.Scan)]
assert len(lssc) == 0
def test_grad_multiple_seqs_different_nsteps(self): def test_grad_multiple_seqs_different_nsteps(self):
# Example provided Michael Forbes # Example provided Michael Forbes
# This test assures that we clip the sequences to n_steps before # This test assures that we clip the sequences to n_steps before
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论