提交 2f1e4887 authored 作者: James Bergstra's avatar James Bergstra

changes to inplace optimizer to encourage stability

上级 9b8bf5b3
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
from .. import gof from .. import gof
from ..gof import opt, InconsistencyError, TopoOptimizer from ..gof import opt, InconsistencyError, TopoOptimizer, graph
from elemwise import Elemwise, DimShuffle from elemwise import Elemwise, DimShuffle
from .. import scalar from .. import scalar
import basic as T import basic as T
...@@ -47,7 +47,7 @@ def insert_inplace_optimizer(env): ...@@ -47,7 +47,7 @@ def insert_inplace_optimizer(env):
x + y + z -> x += y += z x + y + z -> x += y += z
(x + y) * (x * y) -> (x += y) *= (x * y) or (x + y) *= (x *= y) (x + y) * (x * y) -> (x += y) *= (x * y) or (x + y) *= (x *= y)
""" """
for node in list(env.nodes): for node in list(graph.io_toposort(env.inputs, env.outputs)):
op = node.op op = node.op
if not isinstance(op, Elemwise): if not isinstance(op, Elemwise):
continue continue
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论