提交 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): ...@@ -560,7 +560,8 @@ def local_gpu_lazy_ifelse(node):
# Should not happen, but just in case # Should not happen, but just in case
if isinstance(c.type, CudaNdarrayType): if isinstance(c.type, CudaNdarrayType):
c = host_from_gpu(c) 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]): for o in outs]):
return return
......
...@@ -340,11 +340,7 @@ class DimShuffle(Op): ...@@ -340,11 +340,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_API_VERSION < 0x00000007
PyArray_BASE(%(res)s) = (PyObject*)%(basename)s;
#else
PyArray_SetBaseObject(%(res)s, (PyObject*)%(basename)s); PyArray_SetBaseObject(%(res)s, (PyObject*)%(basename)s);
#endif
""" """
'}'] '}']
......
...@@ -930,11 +930,7 @@ class Subtensor(Op): ...@@ -930,11 +930,7 @@ class Subtensor(Op):
finish_view = """ finish_view = """
Py_XDECREF(%(z)s); Py_XDECREF(%(z)s);
Py_INCREF(py_%(x)s); Py_INCREF(py_%(x)s);
#if NPY_API_VERSION < 0x00000007
PyArray_BASE(xview) = py_%(x)s;
#else
PyArray_SetBaseObject(xview, py_%(x)s); PyArray_SetBaseObject(xview, py_%(x)s);
#endif
assert(py_%(x)s == (PyObject*)%(x)s); assert(py_%(x)s == (PyObject*)%(x)s);
%(z)s = xview; %(z)s = xview;
""" % locals() """ % locals()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论