提交 89c0fd7a authored 作者: Frederic Bastien's avatar Frederic Bastien
...@@ -394,10 +394,13 @@ class Method(Component): ...@@ -394,10 +394,13 @@ class Method(Component):
for input in gof.graph.inputs((list(outputs) if isinstance(outputs, (list, tuple)) else [outputs]) for input in gof.graph.inputs((list(outputs) if isinstance(outputs, (list, tuple)) else [outputs])
+ [x.update for x in inputs if getattr(x, 'update', False)], + [x.update for x in inputs if getattr(x, 'update', False)],
blockers = _inputs): blockers = _inputs):
if input not in _inputs and not isinstance(input, gof.Value): if input not in _inputs:
# Add this input to the inputs; we require that storage already exists for them, # Add this input to the inputs; we require that storage already exists for them,
# but otherwise they are immutable. # but otherwise they are immutable.
storage = get_storage(input, not allocate_all) if isinstance(input, gof.Value):
storage = get_storage(input)
else:
storage = get_storage(input, not allocate_all)
inputs.append(storage) inputs.append(storage)
return F.function(inputs, outputs, mode) return F.function(inputs, outputs, mode)
......
...@@ -575,7 +575,7 @@ local_mul_canonizer = Canonizer(T.mul, T.div, T.inv, mul_calculate, False) ...@@ -575,7 +575,7 @@ local_mul_canonizer = Canonizer(T.mul, T.div, T.inv, mul_calculate, False)
@gof.local_optimizer([T.neg]) @gof.local_optimizer([T.neg])
def local_neg_to_mul(node): def local_neg_to_mul(node):
if node.op == T.neg: if node.op == T.neg:
return [-1 * node.inputs[0]] return [T.mul(-1, node.inputs[0])]
else: else:
return False return False
register_canonicalize(local_neg_to_mul) register_canonicalize(local_neg_to_mul)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论