提交 a05ada5d authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Ensure the output is C-contiguous

The C code assumes that the output memory buffer is C-contiguous, and it would be work to change, so we re-allocate a C-contiguous out.
上级 84dd6ae8
......@@ -239,7 +239,9 @@ class mrg_uniform(mrg_uniform_base):
npy_intp odims[%(ndim)s];
int n_elements = 1;
int n_streams = 0;
int must_alloc_sample = ((NULL == %(o_sample)s) || (%(o_sample)s->nd != %(ndim)s));
int must_alloc_sample = ((NULL == %(o_sample)s)
|| (%(o_sample)s->nd != %(ndim)s)
|| !(PyArray_ISCONTIGUOUS(%(o_sample)s)));
%(otype)s * sample_data;
npy_int32 * state_data;
......@@ -280,7 +282,6 @@ class mrg_uniform(mrg_uniform_base):
n_elements *= odims[i];
must_alloc_sample = must_alloc_sample || (%(o_sample)s->dimensions[i] != odims[i]);
//fprintf(stderr, "size %%i %%i\\n", i, (int)odims[i]);
// TODO CHECK STRIDES OF o_sample?
}
if (must_alloc_sample)
{
......@@ -370,9 +371,11 @@ class mrg_uniform(mrg_uniform_base):
state_data_i[5]= x23;
}
//////// </ code generated by mrg_uniform>
""" %locals()
""" % locals()
def c_code_cache_version(self):
return (1,)
return (2,)
class GPU_mrg_uniform(mrg_uniform_base, GpuOp):
#GPU VERSION
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论