提交 95bcd449 authored 作者: Razvan Pascanu's avatar Razvan Pascanu

Fixed bug related to gradients trough a cast.

I have changed the gradients trough a cast to be defined if and only if both the input and output are of continuous types.
上级 d47333ed
......@@ -1290,7 +1290,7 @@ class Cast(UnaryScalarOp):
def c_code(self, node, name, (x, ), (z, ), sub):
return "%s = (%s)%s;" % (z, node.outputs[0].type.dtype_specs()[1], x)
def grad(self, (x, ), (gz, )):
if x.type in continuous_types:
if x.type in continuous_types and self.o_type in continuous_types:
return [cast(gz, x.type.dtype)]
else:
return None,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论