提交 5dcd3999 authored 作者: Frederic's avatar Frederic

Make local_fill_to_alloc in fast_run, not fast_compile. Register it after…

Make local_fill_to_alloc in fast_run, not fast_compile. Register it after stabilize and add local_elemwise_alloc to clean it up.
上级 8c681272
......@@ -1672,13 +1672,15 @@ def local_fill_to_alloc(node):
node,) # theano.printing.debugprint(node.outputs[0], file='str'))
return rval
compile.optdb['canonicalize'].register('local_fill_to_alloc',
in2out(local_fill_to_alloc),
1.1, 'fast_run')
# Register this after stabilize at 1.5 to make sure stabilize don't
# get affected by less canonicalized graph due to alloc.
compile.optdb.register('local_fill_to_alloc',
in2out(local_fill_to_alloc),
1.51, 'fast_run')#, 'canonicalize')
# Needed to clean some extra alloc added by local_fill_to_alloc
compile.optdb['canonicalize'].register('local_elemwise_alloc',
in2out(local_elemwise_alloc),
1.11, 'fast_run')
compile.optdb.register('local_elemwise_alloc',
in2out(local_elemwise_alloc),
1.52, 'fast_run')#, 'canonicalize')
@register_canonicalize("fast_compile")
......
......@@ -481,7 +481,7 @@ class test_canonize(unittest.TestCase):
mode = compile.mode.get_default_mode()
opt = gof.Query(["canonicalize"])
opt = opt.including('ShapeOpt')
opt = opt.including('ShapeOpt', 'local_fill_to_alloc')
opt = opt.excluding(
'local_elemwise_fusion')
mode = mode.__class__(linker=mode.linker, optimizer=opt)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论