提交 11cf8f19 authored 作者: Razvan Pascanu's avatar Razvan Pascanu

Check that the number of inputs of the inner function matches the inputs to

the node.
上级 09a3ead6
...@@ -160,6 +160,20 @@ class Scan(PureOp): ...@@ -160,6 +160,20 @@ class Scan(PureOp):
the inner function) the inner function)
""" """
assert numpy.all(isinstance(i, gof.Variable) for i in inputs) assert numpy.all(isinstance(i, gof.Variable) for i in inputs)
# Check that the number of inputs to the Scan node corresponds to
# the number of inputs of the inner function of scan
n_outer_ins = len(inputs) - len(self.outer_nitsot(inputs)) - 1
n_inner_ins = (len(self.inner_seqs(self.inputs)) +
len(self.mitmot_taps()) +
len(self.mitsot_taps()) +
len(self.inner_sitsot(self.inputs)) +
len(self.inner_shared(self.inputs)) +
len(self.inner_non_seqs(self.inputs)))
assert n_outer_ins == n_inner_ins, \
("The number of inputs given to the lambda function does "
"not match the number of inputs given to the scan op node")
# assert dtype is consistent # assert dtype is consistent
err_msg1 = ('When compiling the inner function of scan the ' err_msg1 = ('When compiling the inner function of scan the '
'following error has been encountered: The ' 'following error has been encountered: The '
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论