提交 35381fc1 authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Prevent moving "gpu_from_host" outside of scan

Detect if the inner replacement would have a different type, so that a new gpu_from_host is not inserted in the inner graph in replacement of the one that was just pushed out.
上级 b321e079
...@@ -250,7 +250,11 @@ class PushOutNonSeqScan(gof.Optimizer): ...@@ -250,7 +250,11 @@ class PushOutNonSeqScan(gof.Optimizer):
for nd in existent_nodes: for nd in existent_nodes:
to_keep += nd.inputs to_keep += nd.inputs
for idx, out in enumerate(to_replace): for idx, out in enumerate(to_replace):
if out in to_keep and out.owner not in existent_nodes: if (out in to_keep
and out.owner not in existent_nodes
# If types are different, conversion Op will be inserted,
# and it may trigger an infinite loop.
and replace_with_in[idx].type == out.type):
clean_to_replace += [out] clean_to_replace += [out]
clean_replace_with_in += [replace_with_in[idx]] clean_replace_with_in += [replace_with_in[idx]]
clean_replace_with_out += [replace_with_out[idx]] clean_replace_with_out += [replace_with_out[idx]]
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论