提交 03f569f9 authored 作者: Reyhane Askari's avatar Reyhane Askari

changed c_code for Gpujoin to be pure C

上级 69e00eb1
...@@ -1349,23 +1349,23 @@ class GpuJoin(HideC, Join): ...@@ -1349,23 +1349,23 @@ class GpuJoin(HideC, Join):
%(fail)s %(fail)s
} }
} }
int tensors_lens_sum;
if(%(view)s != -1){ int tensors_lens_sum;
tensors_lens_sum = 0""" % locals() if(%(view)s != -1) {
tensors_lens_sum = 0;
for inp in tensors: for(int i=0; i < %(n)s; i++){
code += """ + PyGpuArray_DIM(%(inp)s, axis)""" % locals() tensors_lens_sum += als[i]->dimensions[axis];
code += """;\n }
tensors_lens_sum -= PyGpuArray_DIM(%(non_empty_tensor)s, axis); tensors_lens_sum -= PyGpuArray_DIM(%(non_empty_tensor)s, axis);
} }
if(%(view)s != -1 && tensors_lens_sum == 0){
Py_INCREF(%(non_empty_tensor)s); if(%(view)s != -1 && tensors_lens_sum == 0) {
%(out)s = %(non_empty_tensor)s; Py_INCREF(%(non_empty_tensor)s);
} %(out)s = %(non_empty_tensor)s;
else{ }else{
%(out)s = pygpu_concatenate(als, %(n)s, axis, %(out)s = pygpu_concatenate(als, %(n)s, axis,
%(restype)s, (PyObject *)&PyGpuArrayType, %(restype)s, (PyObject *)&PyGpuArrayType,
%(ctx)s); %(ctx)s);
} }
} }
PyMem_Free(als); PyMem_Free(als);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论