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

use the new interface macro.

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