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

small fix following code review.

上级 be9826d9
......@@ -53,8 +53,8 @@ New Features
(Frederic B., Simon McGregor)
* MRG random now raises an error with a clear message when the passed shape
contains dimensions with bad value like 0. (Frédéric B. reported by Ian G.)
* "CudaNdarra[*] = ndarray" work in more case (Frederic B.)
* "CudaNdarra[*] += ndarray" work in more case (Frederic B.)
* "CudaNdarray[*] = ndarray" work in more case (Frederic B.)
* "CudaNdarray[*] += ndarray" work in more case (Frederic B.)
* We add dimensions to CudaNdarray to automatically broadcast more frequently.
(Frederic B.)
......
......@@ -1028,7 +1028,7 @@ def _get_preallocated_maps(node, thunk, prealloc_modes, def_val,
# Build a C-contiguous buffer
new_buf = r.type.value_zeros(r_vals[r].shape)
# CudaNdarray don't have flags field
# assert new_buf.flags["C_CONTIGUOUS"]
# assert new_buf.flags["C_CONTIGUOUS"]
new_buf += numpy.asarray(def_val).astype(r.type.dtype)
c_cont_outputs[r] = new_buf
......
......@@ -1937,9 +1937,10 @@ class GpuAdvancedIncSubtensor1(tensor.AdvancedIncSubtensor1, GpuOp):
return Apply(self, [x_, y_, ilist_], [x_.type()])
#def perform(self, node, inp, out_):
# CudaNdarray_Subscript() don't support Advanced slicing.
# so we use the parent version that loop on each indices.
# But we can't use the parent version that loop on each indices
# as we also need to loop when set_instead_of_inc is True and the
# parent don't look in that case.
def perform(self, node, inp, out_):
# TODO opt to make this inplace
x, y, idx = inp
......
......@@ -1065,7 +1065,9 @@ CudaNdarray_inplace_elemwise(PyObject* py_self, PyObject * py_other, operator_t
{
PyErr_SetString(
PyExc_ValueError,
"CudaNdarray_inplace_elemwise cannot work inplace on un-initialized array when the new value have more then 0 or 1 broadcastable dimensions");
"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);
return 0;
}
......@@ -2802,7 +2804,7 @@ int CudaNdarray_CopyFromCudaNdarray(CudaNdarray * self,
}
else if (self->nd != other->nd)
{
CudaNdarray * new_other = (CudaNdarray *) CudaNdarray_View(other);
new_other = (CudaNdarray *) CudaNdarray_View(other);
int added_dims = self->nd - other->nd;
int pattern[self->nd];
for(int i = 0; i < added_dims; i++)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论