Skip to content

Commit 596daba

Browse files
authored
Merge pull request #5561 from lamblin/fix_5535
Fix crash due to excessive decref of 1
2 parents 168ee75 + b744683 commit 596daba

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

theano/gpuarray/reduction.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ def c_code(self, node, name, input_names, output_names, sub):
6666
for (unsigned i = 0; i < %(name)s_redux_len; ++i) {
6767
PyObject* axis_object = PyTuple_GET_ITEM(%(axes)s, i);
6868
%(name)s_axes_to_reduce[i] = (unsigned) PyInt_AS_LONG(axis_object);
69-
Py_XDECREF(axis_object);
7069
}
7170
7271
size_t %(name)s_input_ndim = PyGpuArray_NDIM(%(X)s);
@@ -136,3 +135,6 @@ def c_code_cleanup(self, node, name, inputs, outputs, sub):
136135
free(%(name)s_output_dims);
137136
free(%(name)s_axes_to_reduce);
138137
""" % {'name': name, 'X': inputs[0]}
138+
139+
def c_code_cache_version(self):
140+
return (1,)

theano/tensor/basic.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1262,7 +1262,6 @@ def c_code(self, node, name, inp, out, sub):
12621262
} else if(PyTuple_GET_SIZE(%(axis)s) == 1) {
12631263
PyObject* axis_object = PyTuple_GET_ITEM(%(axis)s, 0);
12641264
axis = (int)PyInt_AS_LONG(axis_object);
1265-
Py_XDECREF(axis_object);
12661265
if (axis > PyArray_NDIM(%(x)s)-1 || axis < -PyArray_NDIM(%(x)s)) {
12671266
PyErr_SetString(PyExc_ValueError,
12681267
"MaxAndArgmax: bad axis argument");
@@ -1311,7 +1310,7 @@ def c_code(self, node, name, inp, out, sub):
13111310
return ret % locals()
13121311

13131312
def c_code_cache_version(self):
1314-
return (4,)
1313+
return (5,)
13151314

13161315
def infer_shape(self, node, shapes):
13171316
ishape = shapes[0]

0 commit comments

Comments
 (0)