提交 154cc795 authored 作者: --global's avatar --global

Add test case for optimization fix

上级 630e1947
...@@ -2696,6 +2696,27 @@ class T_Scan(unittest.TestCase): ...@@ -2696,6 +2696,27 @@ class T_Scan(unittest.TestCase):
utt.assert_allclose(expected_output, scan_output) utt.assert_allclose(expected_output, scan_output)
utt.assert_allclose(expected_output, jacobian_outputs) utt.assert_allclose(expected_output, jacobian_outputs)
def test_pushout_seqs2(self):
# This test for a bug with PushOutSeqScan that was reported on the
# theano-user mailing list where the optimization raised an exception
# when applied on this graph.
x = tensor.matrix()
outputs, updates = theano.scan(
lambda x: [x*x, tensor.constant(0).copy().copy()],
n_steps=2,
sequences=[],
non_sequences=[],
outputs_info=[x, None])
# Compile a theano function where any optimization error will lead to
# an exception being raised
on_opt_error = theano.config.on_opt_error
theano.config.on_opt_error = 'raise'
try:
theano.function([x], outputs, updates=updates)
finally:
theano.config.on_opt_error = on_opt_error
def test_sequence_dict(self): def test_sequence_dict(self):
# Test that we can specify sequences as a dictionary with # Test that we can specify sequences as a dictionary with
# only the 'input' key # only the 'input' key
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论