提交 d4fcb50a authored 作者: Caglar's avatar Caglar

refactored the code and fixed the condition.

上级 a7552627
...@@ -5,6 +5,7 @@ import copy ...@@ -5,6 +5,7 @@ import copy
import sys import sys
import time import time
import warnings import warnings
import pdb
import numpy import numpy
...@@ -446,7 +447,7 @@ def local_gpu_dot_to_dot22(node): ...@@ -446,7 +447,7 @@ def local_gpu_dot_to_dot22(node):
return False return False
@local_optimizer([gpu_from_host, host_from_gpu]) @local_optimizer([None])
def local_assert_no_cpu_op(node): def local_assert_no_cpu_op(node):
if not isinstance(node.op, GpuOp) and all([var.owner and isinstance(var.owner.op, if not isinstance(node.op, GpuOp) and all([var.owner and isinstance(var.owner.op,
HostFromGpu) for var in node.inputs]) and all([var.owner and HostFromGpu) for var in node.inputs]) and all([var.owner and
...@@ -457,10 +458,10 @@ def local_assert_no_cpu_op(node): ...@@ -457,10 +458,10 @@ def local_assert_no_cpu_op(node):
elif config.assert_no_cpu_op == "raise": elif config.assert_no_cpu_op == "raise":
raise RuntimeError("The op %s is on CPU." % node) raise RuntimeError("The op %s is on CPU." % node)
elif config.assert_no_cpu_op == "pdb": elif config.assert_no_cpu_op == "pdb":
import ipdb; ipdb.set_trace() pdb.set_trace()
return None return None
if config.assert_no_cpu_op != "ignore" and config.assert_no_cpu_op: if config.assert_no_cpu_op != "ignore":
register_opt()(local_assert_no_cpu_op) register_opt()(local_assert_no_cpu_op)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论