提交 196e5406 authored 作者: Frederic's avatar Frederic

use the new interface macro.

上级 fb24e3b7
...@@ -782,7 +782,7 @@ class GpuContiguous(Op): ...@@ -782,7 +782,7 @@ class GpuContiguous(Op):
return ['<numpy_compat.h>'] return ['<numpy_compat.h>']
def c_code_cache_version(self): def c_code_cache_version(self):
return (1,) return (2,)
def c_code(self, node, name, inp, out, sub): def c_code(self, node, name, inp, out, sub):
input, = inp input, = inp
...@@ -790,7 +790,7 @@ class GpuContiguous(Op): ...@@ -790,7 +790,7 @@ class GpuContiguous(Op):
fail = sub['fail'] fail = sub['fail']
str = """ str = """
{ {
if (%(input)s->ga.flags & (GA_C_CONTIGUOUS)){ if (GpuArray_IS_C_CONTIGUOUS(&(%(input)s->ga))){
Py_XDECREF(%(z)s); Py_XDECREF(%(z)s);
%(z)s = %(input)s; %(z)s = %(input)s;
Py_INCREF(%(z)s); Py_INCREF(%(z)s);
...@@ -799,7 +799,7 @@ class GpuContiguous(Op): ...@@ -799,7 +799,7 @@ class GpuContiguous(Op):
for i in xrange(len(node.inputs[0].type.broadcastable)): for i in xrange(len(node.inputs[0].type.broadcastable)):
str += "\n|| (PyGpuArray_DIMS(%(input)s)[%(i)s] != PyGpuArray_DIMS(%(z)s)[%(i)s])" % locals() str += "\n|| (PyGpuArray_DIMS(%(input)s)[%(i)s] != PyGpuArray_DIMS(%(z)s)[%(i)s])" % locals()
str += """ str += """
|| !(%(z)s->ga.flags & GA_C_CONTIGUOUS)) || !GpuArray_IS_C_CONTIGUOUS(&(%(z)s->ga)))
{ {
Py_XDECREF(%(z)s); Py_XDECREF(%(z)s);
%(z)s = pygpu_copy(%(input)s, GA_C_ORDER); %(z)s = pygpu_copy(%(input)s, GA_C_ORDER);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论