提交 d50e1541 authored 作者: Frederic Bastien's avatar Frederic Bastien

fix gh-3070, better error msg

上级 e879bb63
......@@ -499,8 +499,13 @@ class FromFunctionOp(gof.Op):
return 'FromFunctionOp{%s}' % self.__fn.__name__
def make_node(self, *inputs):
assert len(inputs) == len(self.itypes)
assert all(inp.type == it for inp, it in zip(inputs, self.itypes))
if len(inputs) != len(self.itypes):
raise ValueError("We expected %d inputs but got %d." %
(len(self.itypes), len(inputs)))
if not all(inp.type == it for inp, it in zip(inputs, self.itypes)):
raise TypeError(
"We expected inputs of types '%s' but got types '%s' " %
(str([inp.type for inp in inputs]), str(self.itypes)))
return theano.Apply(self, inputs, [o() for o in self.otypes])
def perform(self, node, inputs, outputs):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论