提交 9eb2f249 authored 作者: Frederic's avatar Frederic

Make merge optimizer string behave like the others.

上级 7b28bc29
...@@ -91,6 +91,8 @@ exclude = [] ...@@ -91,6 +91,8 @@ exclude = []
if not theano.config.cxx: if not theano.config.cxx:
exclude = ['cxx_only'] exclude = ['cxx_only']
OPT_NONE = gof.Query(include=[], exclude=exclude) OPT_NONE = gof.Query(include=[], exclude=exclude)
# Even if multiple merge optimizer call will be there, this shouldn't
# impact performance.
OPT_MERGE = gof.Query(include=['merge'], exclude=exclude) OPT_MERGE = gof.Query(include=['merge'], exclude=exclude)
OPT_FAST_RUN = gof.Query(include=['fast_run'], exclude=exclude) OPT_FAST_RUN = gof.Query(include=['fast_run'], exclude=exclude)
OPT_FAST_RUN_STABLE = OPT_FAST_RUN.requiring('stable') OPT_FAST_RUN_STABLE = OPT_FAST_RUN.requiring('stable')
...@@ -113,7 +115,7 @@ OPT_STABILIZE.name = 'OPT_STABILIZE' ...@@ -113,7 +115,7 @@ OPT_STABILIZE.name = 'OPT_STABILIZE'
predefined_optimizers = { predefined_optimizers = {
None: OPT_NONE, None: OPT_NONE,
'None': OPT_NONE, 'None': OPT_NONE,
'merge': gof.MergeOptimizer(), 'merge': OPT_MERGE,
'fast_run': OPT_FAST_RUN, 'fast_run': OPT_FAST_RUN,
'fast_run_stable': OPT_FAST_RUN_STABLE, 'fast_run_stable': OPT_FAST_RUN_STABLE,
'fast_compile': OPT_FAST_COMPILE, 'fast_compile': OPT_FAST_COMPILE,
......
...@@ -25,3 +25,8 @@ def test_no_output_from_implace(): ...@@ -25,3 +25,8 @@ def test_no_output_from_implace():
fct_opt = theano.function([x, y], b, mode=mode_opt) fct_opt = theano.function([x, y], b, mode=mode_opt)
op = fct_opt.maker.fgraph.outputs[0].owner.op op = fct_opt.maker.fgraph.outputs[0].owner.op
assert (not hasattr(op, 'destroy_map') or 0 not in op.destroy_map) assert (not hasattr(op, 'destroy_map') or 0 not in op.destroy_map)
def test_including():
mode = theano.Mode(optimizer='merge')
mode.including('fast_compile')
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论