提交 ac2ab0aa authored 作者: Frederic Bastien's avatar Frederic Bastien

make local_gpu_sum raise an exception when the sum pattern is not implemented.…

make local_gpu_sum raise an exception when the sum pattern is not implemented. It make the optimizer catch this error instead of failing at compile time.
上级 a300e1e2
......@@ -180,7 +180,12 @@ def local_gpu_sum(node):
for a in node.op.axis:
assert reduce_mask[a] == 0
reduce_mask[a] = 1
return [host_from_gpu(GpuSum(reduce_mask)(gpu_from_host(x)))]
gsum=GpuSum(reduce_mask)
pattern=(''.join(str(i) for i in reduce_mask))
if hasattr(gsum, 'c_code_reduce_%s'%pattern):
return [host_from_gpu(gsum(gpu_from_host(x)))]
else:
raise Exception("GpuSum don't have implemented the pattern",pattern)
return False
@register_opt()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论