提交 a3810051 authored 作者: Pierre Luc Carrier's avatar Pierre Luc Carrier

Convert output creation to use pygpu_empty()

上级 ab74f6b0
...@@ -201,6 +201,8 @@ class GpuImages2Neibs(Images2Neibs, Op): ...@@ -201,6 +201,8 @@ class GpuImages2Neibs(Images2Neibs, Op):
z, = out z, = out
fail = sub['fail'] fail = sub['fail']
mode = self.mode mode = self.mode
typecode_z = pygpu.gpuarray.dtype_to_typecode(node.outputs[0].dtype)
return """ return """
#ifndef CEIL_INTDIV #ifndef CEIL_INTDIV
#define CEIL_INTDIV(a, b) ((a/b) + ((a %% b) ? 1: 0)) #define CEIL_INTDIV(a, b) ((a/b) + ((a %% b) ? 1: 0))
...@@ -312,7 +314,9 @@ class GpuImages2Neibs(Images2Neibs, Op): ...@@ -312,7 +314,9 @@ class GpuImages2Neibs(Images2Neibs, Op):
npy_intp dims[2]; npy_intp dims[2];
dims[0] = z_dim0; dims[0] = z_dim0;
dims[1] = z_dim1; dims[1] = z_dim1;
%(z)s = (CudaNdarray*)CudaNdarray_NewDims(2, dims); %(z)s = pygpu_empty(2, dims, %(typecode_z)s,
GA_C_ORDER, pygpu_default_context(),
Py_None);
if (!%(z)s) if (!%(z)s)
{ {
PyErr_SetString(PyExc_MemoryError, PyErr_SetString(PyExc_MemoryError,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论