提交 b7880c5f authored 作者: Frederic's avatar Frederic

Use the same attribute checking as done in NumPy.

上级 9dada913
...@@ -336,7 +336,7 @@ class DimShuffle(Op): ...@@ -336,7 +336,7 @@ class DimShuffle(Op):
'PyArray_UpdateFlags(%(res)s, NPY_ARRAY_UPDATE_ALL)', 'PyArray_UpdateFlags(%(res)s, NPY_ARRAY_UPDATE_ALL)',
#we are making a view in both inplace and non-inplace cases #we are making a view in both inplace and non-inplace cases
""" """
#if NPY_VERSION < 0x01000009 #if NPY_API_VERSION < 0x00000007
PyArray_BASE(%(res)s) = (PyObject*)%(basename)s; PyArray_BASE(%(res)s) = (PyObject*)%(basename)s;
#else #else
PyArray_SetBaseObject(%(res)s, (PyObject*)%(basename)s); PyArray_SetBaseObject(%(res)s, (PyObject*)%(basename)s);
......
...@@ -862,7 +862,7 @@ class Subtensor(Op): ...@@ -862,7 +862,7 @@ class Subtensor(Op):
finish_view = """ finish_view = """
if (%(z)s) Py_DECREF(%(z)s); if (%(z)s) Py_DECREF(%(z)s);
Py_INCREF(py_%(x)s); Py_INCREF(py_%(x)s);
#if NPY_VERSION < 0x01000009 #if NPY_API_VERSION < 0x00000007
PyArray_BASE(xview) = py_%(x)s; PyArray_BASE(xview) = py_%(x)s;
#else #else
PyArray_SetBaseObject(xview, py_%(x)s); PyArray_SetBaseObject(xview, py_%(x)s);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论