提交 a5f0db37 authored 作者: James Bergstra's avatar James Bergstra

Added copy() to inner loop of OpFromGraph.perform to workaround borrowed output

problem.
上级 045cfbfb
......@@ -80,8 +80,11 @@ class OpFromGraph(gof.Op):
def perform(self, node, inputs, outputs):
variables = self.fn(*inputs)
assert len(variables) == len(outputs)
for output, variable in zip(outputs, variables):
output[0] = variable
##TODO: when function's output-borrowing semantics are correct, we wont need this
# copy anymore
output[0] = variable.copy()
def grad(self, inputs, output_grads):
if hasattr(self, 'grad_ops'):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论