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

made get_constant_value look through scalar casts

上级 8eac84d9
...@@ -500,8 +500,9 @@ def get_constant_value(v): ...@@ -500,8 +500,9 @@ def get_constant_value(v):
# Don't act as the constant_folding optimization here as this # Don't act as the constant_folding optimization here as this
# fct is used too early in the optimization phase. This would # fct is used too early in the optimization phase. This would
# mess with the stabilization optimization. # mess with the stabilization optimization.
if isinstance(v.owner.op, Elemwise) and isinstance( if (isinstance(v.owner.op, Elemwise) and isinstance(
v.owner.op.scalar_op, scal.Cast): v.owner.op.scalar_op, scal.Cast)) or \
isinstance(v.owner.op, scal.Cast):
const = get_constant_value(v.owner.inputs[0]) const = get_constant_value(v.owner.inputs[0])
ret = [[None]] ret = [[None]]
v.owner.op.perform(v.owner, [const], ret) v.owner.op.perform(v.owner, [const], ret)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论