提交 1bead68f authored 作者: James Bergstra's avatar James Bergstra

added an alloc-removing optimization

上级 6496b0c0
...@@ -490,6 +490,14 @@ def local_fill_to_alloc(node): ...@@ -490,6 +490,14 @@ def local_fill_to_alloc(node):
assert rval[0].type == node.outputs[0].type assert rval[0].type == node.outputs[0].type
return rval return rval
@register_specialize
@register_canonicalize
@gof.local_optimizer([T._shape])
def local_useless_alloc(node):
if node.op == T.alloc:
if node.inputs[0].type == node.outputs[0].type:
return [node.inputs[0]]
@register_specialize @register_specialize
@register_canonicalize @register_canonicalize
@gof.local_optimizer([T._shape]) @gof.local_optimizer([T._shape])
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论