提交 a1530fe2 authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Fix when a variable is both an input and an output

上级 1b3afdf0
...@@ -559,8 +559,10 @@ class CLinker(link.Linker): ...@@ -559,8 +559,10 @@ class CLinker(link.Linker):
# what to do at the beginning of each run, # what to do at the beginning of each run,
# what to do at the end of each run]] # what to do at the end of each run]]
if variable in self.inputs: if variable in self.inputs:
# we need to extract the new inputs at each run # We need to extract the new inputs at each run
# they do not need to be relayed to Python, so we don't sync # they do not need to be relayed to Python, so we don't sync.
# If the variable is both an input and an output, there is
# no need to synchronize either, it is already up-to-date.
policy = [[get_nothing, get_nothing, get_nothing], policy = [[get_nothing, get_nothing, get_nothing],
[get_c_declare, get_c_extract, get_c_cleanup]] [get_c_declare, get_c_extract, get_c_cleanup]]
elif variable in self.orphans: elif variable in self.orphans:
...@@ -972,6 +974,10 @@ class CLinker(link.Linker): ...@@ -972,6 +974,10 @@ class CLinker(link.Linker):
if output_storage is None: if output_storage is None:
map = {} map = {}
output_storage = [] output_storage = []
# Initialize the map with the inputs, as some outputs may
# be inputs as well.
for i, variable in enumerate(self.inputs):
map[variable] = input_storage[i]
for variable in self.outputs: for variable in self.outputs:
if variable not in map: if variable not in map:
map[variable] = [None] map[variable] = [None]
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论