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

Merge pull request #5490 from nouiz/opt_crash

Opt crash
......@@ -560,7 +560,8 @@ def local_gpu_lazy_ifelse(node):
# Should not happen, but just in case
if isinstance(c.type, CudaNdarrayType):
c = host_from_gpu(c)
if all([isinstance(o.type, CudaNdarrayType) or o.dtype != 'float32'
if all([isinstance(o.type, CudaNdarrayType) or
getattr(o, 'dtype', None) != 'float32'
for o in outs]):
return
......
......@@ -340,11 +340,7 @@ class DimShuffle(Op):
'PyArray_UpdateFlags(%(res)s, NPY_ARRAY_UPDATE_ALL)',
# we are making a view in both inplace and non-inplace cases
"""
#if NPY_API_VERSION < 0x00000007
PyArray_BASE(%(res)s) = (PyObject*)%(basename)s;
#else
PyArray_SetBaseObject(%(res)s, (PyObject*)%(basename)s);
#endif
"""
'}']
......
......@@ -930,11 +930,7 @@ class Subtensor(Op):
finish_view = """
Py_XDECREF(%(z)s);
Py_INCREF(py_%(x)s);
#if NPY_API_VERSION < 0x00000007
PyArray_BASE(xview) = py_%(x)s;
#else
PyArray_SetBaseObject(xview, py_%(x)s);
#endif
assert(py_%(x)s == (PyObject*)%(x)s);
%(z)s = xview;
""" % locals()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论