提交 1f01eab6 authored 作者: Arnaud Bergeron's avatar Arnaud Bergeron

Fix the strides for the weight matrices.

上级 32b75e7f
...@@ -2146,10 +2146,11 @@ class _RNNSplitParams(DnnBase): ...@@ -2146,10 +2146,11 @@ class _RNNSplitParams(DnnBase):
// We assume that the typecode matches // We assume that the typecode matches
%(m)s = pygpu_reshape(%(w)s, 2, nshp, GA_C_ORDER, 1, -1); %(m)s = pygpu_reshape(%(w)s, 2, nshp, GA_C_ORDER, 1, -1);
%(m)s->ga.offset = off; %(m)s->ga.offset = off;
assert(dims[0] %% bshp == 0);
%(m)s->ga.dimensions[0] = dims[0] / bshp; %(m)s->ga.dimensions[0] = dims[0] / bshp;
%(m)s->ga.dimensions[1] = bshp; %(m)s->ga.dimensions[1] = bshp;
%(m)s->ga.strides[0] = bshp * gpuarray_get_elsize(%(m)s->ga.typecode); %(m)s->ga.strides[0] = %(m)s->ga.strides[1];
// strides[1] is already ok %(m)s->ga.strides[1] = %(m)s->ga.dimensions[0] * gpuarray_get_elsize(%(m)s->ga.typecode);
""" % kw2 """ % kw2
for i in range(len(outputs)//2): for i in range(len(outputs)//2):
...@@ -2162,6 +2163,9 @@ class _RNNSplitParams(DnnBase): ...@@ -2162,6 +2163,9 @@ class _RNNSplitParams(DnnBase):
""" """
return code return code
def c_code_cache_version(self):
return (1,)
def _split_rnn_params(w, desc, layer, input_size, dtype, rnn_mode): def _split_rnn_params(w, desc, layer, input_size, dtype, rnn_mode):
typecode = gpuarray.dtype_to_typecode(dtype) typecode = gpuarray.dtype_to_typecode(dtype)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论