提交 dd4c1c33 authored 作者: --global's avatar --global

Add test case for bugfix

上级 f159d9eb
......@@ -2431,6 +2431,27 @@ class T_Scan(unittest.TestCase):
utt.assert_allclose(output1, expected_output1)
utt.assert_allclose(output2, expected_output2)
def test_use_scan_direct_output2(self):
# This test looks for a crash that happened when directly using the
# recurrent output of a scan node associated with a state with a
# state with broadcastable dimensions
x = tensor.col()
seq = tensor.col()
outputs_info=[x, tensor.zeros_like(x)]
(out1, out2), updates = theano.scan(lambda a, b, c : (a + b, b + c),
sequences=seq,
outputs_info=outputs_info)
# Obtain a reference to the scan outputs before the subtensor and
# compile a function with them as outputs
assert isinstance(out1.owner.op, tensor.subtensor.Subtensor)
assert isinstance(out2.owner.op, tensor.subtensor.Subtensor)
out1_direct = out1.owner.inputs[0]
out2_direct = out2.owner.inputs[0]
fct = theano.function([x, seq],
[out1_direct, out2_direct])
def test_infer_shape(self):
# Test for a crash in scan.infer_shape when using both
# an until condition and random sampling in the inner function.
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论