提交 0b3fe629 authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Fix when scan sequences are provided as a 1-key dict

Add test for that case
上级 31a2fdb2
......@@ -384,7 +384,7 @@ def scan(fn,
seqs[i] = OrderedDict([('input', seqs[i]), ('taps', [0])])
elif seqs[i].get('taps', None):
seqs[i]['taps'] = wrap_into_list(seqs[i]['taps'])
elif seqs[i].get('taps', True) is None:
elif seqs[i].get('taps', None) is None:
# seqs dictionary does not have the ``taps`` key
seqs[i]['taps'] = [0]
......
......@@ -2477,6 +2477,18 @@ class T_Scan(unittest.TestCase):
# Run it so DebugMode can detect optimization problems.
f(x_val, y_val)
def test_sequence_dict(self):
# Test that we can specify sequences as a dictionary with
# only the 'input' key
def incr(s):
return s + 1
x = theano.tensor.vector()
sx, upx = theano.scan(
fn=incr,
sequences=[{'input': x}])
f = theano.function([x], sx)
def test_hash(self):
x = theano.tensor.vector()
y = theano.tensor.vector()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论