提交 e87e11cf authored 作者: Ian Goodfellow's avatar Ian Goodfellow

fixed bug in Add.grad

上级 38515281
......@@ -1149,15 +1149,16 @@ class Add(ScalarOp):
return z + " = " + " + ".join(inputs) + ";"
def grad(self, inputs, (gz, )):
retval = []
if gz.type in complex_types:
raise NotImplementedError()
elif gz.type in float_types:
for i in inputs:
retval += [gz]
else:
if self(*inputs).type in discrete_types:
assert gz is not None
retval = [ inp.zeros_like.astype(theano.config.floatX)
for inp in inputs]
for inp in inputs]
else:
retval = []
for i in inputs:
retval += [gz]
return retval
add = Add(upcast_out, name='add')
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论