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

Disable opt in some case discovered in new tests crash with the new opt.

上级 7700bfbc
......@@ -3462,11 +3462,17 @@ ALL_REDUCE = [T.elemwise.CAReduce, T.elemwise.All, T.elemwise.Any,
T.elemwise.Sum, T.elemwise.Prod,
T.elemwise.ProdWithoutZeros]
@register_canonicalize
@register_uncanonicalize # Needed for MaxAndArgmax -> CAReduce
@gof.local_optimizer(ALL_REDUCE)
def local_reduce_join(node):
"""Max(Join(a,b), axis=0) -> Maximum(a,b) """
"""Reduce{scalar.op}(Join(a, b), axis=0) -> Elemwise{scalar.op}(a, b)
:note: supported scalar.op are Maximum, Mimimum in some cases and
Add and Mul in all cases.
"""
if (isinstance(node.op, T.CAReduce) and
node.inputs[0].owner and
isinstance(node.inputs[0].owner.op, T.Join)):
......@@ -3481,6 +3487,9 @@ def local_reduce_join(node):
return
elif not isinstance(node.op.scalar_op, (scalar.Add, scalar.Mul)):
return
elif len(join.inputs) <= 2:
# This is a useless join, that will get removed by another opt.
return
new_inp = []
for inp in join.inputs[1:]:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论