提交 61a7aac9 authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Correctly treat remaining factors in optimization

instead of asserting they did not exist.
上级 b0de5da7
...@@ -1940,14 +1940,15 @@ def local_dot22_to_dot22scalar(node): ...@@ -1940,14 +1940,15 @@ def local_dot22_to_dot22scalar(node):
assert not a.type.ndim assert not a.type.ndim
dot = _dot22scalar(d.owner.inputs[0], d.owner.inputs[1], a) dot = _dot22scalar(d.owner.inputs[0], d.owner.inputs[1], a)
# What about the other inputs to the original node that were # The other inputs to the original node that were
# neither part of the dot22 or this mul? # neither part of the dot22 or this mul should be
# I'm asserting there are no such inputs here: # factors in the returned "mul" node.
assert dot22_idx != mul_idx assert dot22_idx != mul_idx
assert all((i in (dot22_idx, mul_idx)) other_factors = [inpt
for i in xrange(len(node.inputs))) for i, inpt in enumerate(node.inputs)
if i not in (dot22_idx, mul_idx)]
return [T.mul(m.owner.inputs[1 - i], dot)] return [T.mul(m.owner.inputs[1 - i], dot, *other_factors)]
elif m.owner and m.owner.op == T.mul: elif m.owner and m.owner.op == T.mul:
_logger.info('Not optimizing dot22 with inputs %s %s %s %s. ' _logger.info('Not optimizing dot22 with inputs %s %s %s %s. '
'we need to check in a recursive way in the mul if we can ' 'we need to check in a recursive way in the mul if we can '
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论