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

gof/cc - fixed longstanding bug in OpWiseCLinker handling of no_recycling…

gof/cc - fixed longstanding bug in OpWiseCLinker handling of no_recycling argument to CLinker when allow_gc=True
上级 ca0945c9
...@@ -1117,7 +1117,14 @@ class OpWiseCLinker(link.LocalLinker): ...@@ -1117,7 +1117,14 @@ class OpWiseCLinker(link.LocalLinker):
debug('Compiling node %i of graph' % node_idx) debug('Compiling node %i of graph' % node_idx)
try: try:
e = Env(*graph.clone(node.inputs, node.outputs)) e = Env(*graph.clone(node.inputs, node.outputs))
cl = CLinker().accept(e, [r for r, r2 in zip(e.outputs, node.outputs) if r2 in no_recycling]) if self.allow_gc:
# if we allow garbage collection of intermediate nodes
# we must forbid this C implementatio from cacheing its own
# reference to its output
node_no_recycling = e.outputs
else:
node_no_recycling = [r for r, r2 in zip(e.outputs, node.outputs) if r2 in no_recycling]
cl = CLinker().accept(e, node_no_recycling)
debug('Trying CLinker.make_thunk') debug('Trying CLinker.make_thunk')
thunk, node_input_filters, node_output_filters = cl.make_thunk( thunk, node_input_filters, node_output_filters = cl.make_thunk(
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论