提交 9a281ed6 authored 作者: carriepl's avatar carriepl

Add comments

上级 5f448b1e
...@@ -360,13 +360,16 @@ def inplace_elemwise_optimizer_op(OP): ...@@ -360,13 +360,16 @@ def inplace_elemwise_optimizer_op(OP):
for inp_idx in candidate_inputs: for inp_idx in candidate_inputs:
inp = node.inputs[inp_idx] inp = node.inputs[inp_idx]
if inp in updated_inputs: if inp in updated_inputs:
# the candidate input is the actual updated input
updated_vars.append(inp_idx) updated_vars.append(inp_idx)
elif (hasattr(fgraph, 'destroy_handler') and elif (hasattr(fgraph, 'destroy_handler') and
inp.owner and inp.owner and
any([(up_inp in fgraph.destroy_handler.root_destroyer and any([fgraph.destroy_handler.root_destroyer.get(up_inp, None) is inp.owner
fgraph.destroy_handler.root_destroyer[up_inp] is inp.owner)
for up_inp in updated_inputs])): for up_inp in updated_inputs])):
# the candidate input is a variable computed
# inplace on the updated input via a sequence of
# one or more inplace operations
vars_from_inplace.append(inp_idx) vars_from_inplace.append(inp_idx)
else: else:
other_vars.append(inp_idx) other_vars.append(inp_idx)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论