提交 80365291 authored 作者: Lijun Xue's avatar Lijun Xue

fix lazy op error

上级 fa14acce
......@@ -954,7 +954,7 @@ class VM_Linker(link.LocalLinker):
break
for out in order[i].outputs:
if (getattr(out, 'ndim', None) == 0 and out not in pre_allocated
and ins.type == out.type):
and ins.type == out.type):
reuse_out = out
pre_allocated.add(out)
elif ins in view_of:
......@@ -969,23 +969,14 @@ class VM_Linker(link.LocalLinker):
if reuse_out:
break
for out in order[i].outputs:
if (getattr(out, 'ndim', None) == 0 and out not in pre_allocated
and ins.type == out.type):
if (getattr(out, 'ndim', None) == 0 and out not in pre_allocated
and ins.type == out.type):
reuse_out = out
pre_allocated.add(out)
if reuse_out:
reallocated_info[ins] = [ins, reuse_out]
lazy = self.lazy
if lazy is None:
lazy = config.vm.lazy
if lazy is None:
lazy = not all([(not th.lazy) for th in thunks])
if not (lazy or (config.profile and config.profile_memory) or self.use_cloop or self.callback):
for pair in reallocated_info.values():
storage_map[pair[1]] = storage_map[pair[0]]
for node in order:
try:
thunks.append(node.op.make_thunk(node,
......@@ -1005,6 +996,15 @@ class VM_Linker(link.LocalLinker):
thunk.inputs = [storage_map[v] for v in node.inputs]
thunk.outputs = [storage_map[v] for v in node.outputs]
lazy = self.lazy
if lazy is None:
lazy = config.vm.lazy
if lazy is None:
lazy = not all([(not th.lazy) for th in thunks])
if not (lazy or (config.profile and config.profile_memory) or self.use_cloop or self.callback):
for pair in reallocated_info.values():
storage_map[pair[1]] = storage_map[pair[0]]
computed, last_user = link.gc_helper(order)
if self.allow_gc:
post_thunk_clear = []
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论