提交 382ebb68 authored 作者: Razvan Pascanu's avatar Razvan Pascanu 提交者: David Warde-Farley

ifelse inplace

上级 3769c516
...@@ -302,3 +302,18 @@ def ifelse( cond, true_branch, false_branch, name = None): ...@@ -302,3 +302,18 @@ def ifelse( cond, true_branch, false_branch, name = None):
else: else:
return rval return rval
@gof.local_optimizer([None])
def cond_make_inplace(node):
op = node.op
if isinstance(op, IfElse) and not op.as_view :
return IfElse(n_outs = op.n_outs,
as_view = True,
gpu = op.gpu,
name = op.name ).make_node(*node.inputs).outputs
return False
optdb.register('cond_make_inplace', opt.in2out(cond_make_inplace,
ignore_newtrees=True), 95, 'fast_run', 'inplace')
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论