提交 7de03932 authored 作者: Olivier Delalleau's avatar Olivier Delalleau

Finalizing merge - My bad for not updating Theano before (re-)fixing bug :/

上级 def02f4d
...@@ -224,15 +224,19 @@ class DimShuffle(Op): ...@@ -224,15 +224,19 @@ class DimShuffle(Op):
for i in xrange(nd_out-2,-1, -1): for i in xrange(nd_out-2,-1, -1):
strides_statements.append("if (strides[%(i)s] == 0) strides[%(i)s] = strides[%(i)s+1] * dimensions[%(i)s+1]"%dict(i=str(i))) strides_statements.append("if (strides[%(i)s] == 0) strides[%(i)s] = strides[%(i)s+1] * dimensions[%(i)s+1]"%dict(i=str(i)))
#
# PyObject* PyArray_New(PyTypeObject* subtype, int nd, npy_intp* dims, int type_num,
# npy_intp* strides, void* data, int itemsize, int flags, PyObject* obj)
#
close_bracket = [ close_bracket = [
#create a new array, #create a new array,
('%(res)s = (PyArrayObject*)PyArray_New(&PyArray_Type, ' ('%(res)s = (PyArrayObject*)PyArray_New(&PyArray_Type, '
'' + str(nd_out) + ', dimensions, ' '' + str(nd_out) + ', dimensions, '
'PyArray_TYPE(%(basename)s), strides, ' 'PyArray_TYPE(%(basename)s), strides, '
'%(basename)s->data, %(basename)s->descr->elsize, ' '%(basename)s->data, PyArray_ITEMSIZE(%(basename)s), '
#borrow only the writable flag from the base #borrow only the writable flag from the base
# the NPY_OWNDATA flag will default to 0. # the NPY_OWNDATA flag will default to 0.
'PyArray_ISWRITEABLE(%(basename)s) ? NPY_WRITEABLE : 0, NULL)'), '(NPY_WRITEABLE*PyArray_ISWRITEABLE(%(basename)s)), NULL)'),
#recalculate flags: CONTIGUOUS, FORTRAN, ALIGNED #recalculate flags: CONTIGUOUS, FORTRAN, ALIGNED
'PyArray_UpdateFlags(%(res)s, NPY_UPDATE_ALL)', 'PyArray_UpdateFlags(%(res)s, NPY_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
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论