提交 9835fbdb authored 作者: Frederic Bastien's avatar Frederic Bastien

Make an opt don't add useless node that futur opt would remove.

上级 4752037c
...@@ -3251,12 +3251,15 @@ def local_IncSubtensor_serialize(node): ...@@ -3251,12 +3251,15 @@ def local_IncSubtensor_serialize(node):
if movable_inputs: if movable_inputs:
new_inputs = ([i for i in node.inputs if not movable(i)] + new_inputs = ([i for i in node.inputs if not movable(i)] +
[mi.owner.inputs[0] for mi in movable_inputs]) [mi.owner.inputs[0] for mi in movable_inputs])
new_add = T.add(*new_inputs) if len(new_inputs) == 0:
new_add = new_inputs[0]
else:
new_add = T.add(*new_inputs)
# Copy over stacktrace from original output, as an error # Copy over stacktrace from original output, as an error
# (e.g. an index error) in this add operation should # (e.g. an index error) in this add operation should
# correspond to an error in the original add operation. # correspond to an error in the original add operation.
copy_stack_trace(node.outputs[0], new_add) copy_stack_trace(node.outputs[0], new_add)
# stack up the new incsubtensors # stack up the new incsubtensors
tip = new_add tip = new_add
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论