提交 fe0b1477 authored 作者: Pascal Lamblin's avatar Pascal Lamblin 提交者: Frederic Bastien

Fix problem with python 3.5.

It would raise a SystemError wrapping the IndexError already raised.
上级 ffcad649
...@@ -1956,6 +1956,7 @@ class AdvancedIncSubtensor1(Op): ...@@ -1956,6 +1956,7 @@ class AdvancedIncSubtensor1(Op):
copy_of_x = self.copy_of_x(x) copy_of_x = self.copy_of_x(x)
return """ return """
PyObject* rval = NULL;
if (%(inplace)s) if (%(inplace)s)
{ {
if (%(x)s != %(out)s) if (%(x)s != %(out)s)
...@@ -1971,12 +1972,16 @@ class AdvancedIncSubtensor1(Op): ...@@ -1971,12 +1972,16 @@ class AdvancedIncSubtensor1(Op):
%(out)s = %(copy_of_x)s; %(out)s = %(copy_of_x)s;
} }
PyObject *arglist = Py_BuildValue("OOOi",%(out)s, %(idx)s, %(y)s, %(inc_or_set)d); PyObject *arglist = Py_BuildValue("OOOi",%(out)s, %(idx)s, %(y)s, %(inc_or_set)d);
inplace_increment(NULL, arglist); rval = inplace_increment(NULL, arglist);
Py_XDECREF(arglist); Py_XDECREF(arglist);
if (rval == NULL) {
%(fail)s;
}
Py_XDECREF(rval);
""" % locals() """ % locals()
def c_code_cache_version(self): def c_code_cache_version(self):
return (1,) return (2,)
def perform(self, node, inp, out_): def perform(self, node, inp, out_):
# TODO opt to make this inplace # TODO opt to make this inplace
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论