提交 da3c4cd0 authored 作者: Frédéric Bastien's avatar Frédéric Bastien

Merge pull request #3000 from lamblin/cuda_takefrom_refcount

Do not decref descriptor, as PyArray_View steals the reference
...@@ -1030,7 +1030,6 @@ CudaNdarray_TakeFrom(CudaNdarray * self, PyObject *args){ ...@@ -1030,7 +1030,6 @@ CudaNdarray_TakeFrom(CudaNdarray * self, PyObject *args){
PyObject * indices_float32 = NULL; PyObject * indices_float32 = NULL;
indices_float32 = PyArray_View((PyArrayObject*)indices_obj, indices_float32 = PyArray_View((PyArrayObject*)indices_obj,
float32_descr, NULL); float32_descr, NULL);
Py_DECREF(float32_descr);
if (verbose) printf("ndarray indices\n"); if (verbose) printf("ndarray indices\n");
if (!indices_float32) if (!indices_float32)
return NULL; return NULL;
...@@ -1065,7 +1064,7 @@ CudaNdarray_TakeFrom(CudaNdarray * self, PyObject *args){ ...@@ -1065,7 +1064,7 @@ CudaNdarray_TakeFrom(CudaNdarray * self, PyObject *args){
if(!CudaNdarray_is_c_contiguous(indices) != 0) { if(!CudaNdarray_is_c_contiguous(indices) != 0) {
PyErr_SetString(PyExc_NotImplementedError, PyErr_SetString(PyExc_NotImplementedError,
"CudaNdarray_TakeFrom: The indices must be contiguous in memory."); "CudaNdarray_TakeFrom: The indices must be contiguous in memory.");
Py_DECREF(indices_obj); Py_DECREF(indices);
return NULL; return NULL;
} }
int nb_indices = CudaNdarray_SIZE((CudaNdarray *)indices) / 2;// int64 are 8 bytes, float32 are 4 bytes int nb_indices = CudaNdarray_SIZE((CudaNdarray *)indices) / 2;// int64 are 8 bytes, float32 are 4 bytes
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论