提交 45bd626b authored 作者: Ian Goodfellow's avatar Ian Goodfellow

add some type checking in Elemwise._bgrad

上级 680764d7
...@@ -685,6 +685,10 @@ class Elemwise(Op): ...@@ -685,6 +685,10 @@ class Elemwise(Op):
theano.config.compute_test_value = prev_setting theano.config.compute_test_value = prev_setting
if not isinstance(scalar_igrads,(list,tuple)):
raise TypeError('%s.grad returned %s instead of list or tuple' %
(str(self.scalar_op), str(type(scalar_igrads))))
nd = len(inputs[0].type.broadcastable) # this is the same for everyone nd = len(inputs[0].type.broadcastable) # this is the same for everyone
def transform(r): def transform(r):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论