提交 0e00a9a1 authored 作者: Frederic Bastien's avatar Frederic Bastien

Disabled part of an optimization that give wrong result!

上级 355fde81
...@@ -1629,7 +1629,9 @@ def local_sum_div_dimshuffle(node): ...@@ -1629,7 +1629,9 @@ def local_sum_div_dimshuffle(node):
dimshuffled = None dimshuffled = None
if thing_summed.owner and thing_summed.owner.op == T.true_div: if thing_summed.owner and thing_summed.owner.op == T.true_div:
numerator, denominator = thing_summed.owner.inputs numerator, denominator = thing_summed.owner.inputs
if numerator.owner and isinstance(numerator.owner.op, T.DimShuffle): #This if have bad logic. See its test in tensor/tests/test_opt.py:T_local_sum_dimshuffle
#that fail when we enable this if.
if False and numerator.owner and isinstance(numerator.owner.op, T.DimShuffle):
new_order = numerator.owner.op.new_order new_order = numerator.owner.op.new_order
#print 'new_order =', new_order #print 'new_order =', new_order
# check compatibility # check compatibility
......
...@@ -1581,8 +1581,11 @@ class T_local_sum_dimshuffle(unittest.TestCase): ...@@ -1581,8 +1581,11 @@ class T_local_sum_dimshuffle(unittest.TestCase):
theano.printing.debugprint(f) theano.printing.debugprint(f)
g = f.maker.env.toposort() g = f.maker.env.toposort()
#print 'g =', g #print 'g =', g
assert g[-1].op == T.true_div f([[1,1],[1,1]],[1,1],[[[1,1],[1,1]],[[1,1],[1,1]]])
num, denum = s.owner.inputs[0].owner.inputs
if denum.owner and isinstance(denum.owner.op, T.DimShuffle):
assert g[-1].op == T.true_div
# TODO: # TODO:
# test_local_sum_prod_dimshuffle (a * b * c) # test_local_sum_prod_dimshuffle (a * b * c)
# test_local_sum_divprod_dimshuffle ((a * b) / (c * d)) # test_local_sum_divprod_dimshuffle ((a * b) / (c * d))
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论