提交 c3ccdb90 authored 作者: Frederic's avatar Frederic

Don't use an wrapper optimization when it is not needed.

This make the printing of the reason be simpler/more readable.
上级 d839d267
......@@ -49,14 +49,24 @@ theano.configparser.AddConfigVar('on_shape_error',
def out2in(*local_opts):
"""WRITEME """
return opt.TopoOptimizer(opt.LocalOptGroup(*local_opts),
if len(local_opts) > 1:
# Don't wrap it uselessly if their is only 1 optimization.
local_opts = opt.LocalOptGroup(*local_opts),
else:
local_opts, = local_opts
return opt.TopoOptimizer(local_opts,
order='out_to_in',
failure_callback=TopoOptimizer.warn_inplace)
def in2out(*local_opts, **kwargs):
"""WRITEME """
return opt.TopoOptimizer(opt.LocalOptGroup(*local_opts),
if len(local_opts) > 1:
# Don't wrap it uselessly if their is only 1 optimization.
local_opts = opt.LocalOptGroup(*local_opts),
else:
local_opts, = local_opts
return opt.TopoOptimizer(local_opts,
order='in_to_out',
failure_callback=TopoOptimizer.warn_inplace,
**kwargs)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论