提交 5fd2cb21 authored 作者: Frederic's avatar Frederic

Allow CudaNdarray_inplace_elemwise on empty array for broadcasted constant as numpy.

上级 19da7c2d
...@@ -1060,11 +1060,12 @@ CudaNdarray_inplace_elemwise(PyObject* py_self, PyObject * py_other, operator_t ...@@ -1060,11 +1060,12 @@ CudaNdarray_inplace_elemwise(PyObject* py_self, PyObject * py_other, operator_t
if (size==0) if (size==0)
{ {
if (CudaNdarray_SIZE((CudaNdarray *)py_other)) int other_size = CudaNdarray_SIZE((CudaNdarray *)py_other);
if (!(other_size == 0 || other_size == 1))
{ {
PyErr_SetString( PyErr_SetString(
PyExc_ValueError, PyExc_ValueError,
"CudaNdarray_inplace_elemwise cannot work inplace on an un-initialized array"); "CudaNdarray_inplace_elemwise cannot work inplace on un-initialized array when the new value have more then 0 or 1 broadcastable dimensions");
Py_XDECREF(new_other); Py_XDECREF(new_other);
return 0; return 0;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论