From acb59dc516c51b96b4c4ea4c91eba04b8a254384 Mon Sep 17 00:00:00 2001 From: davidweichiang Date: Sun, 5 Jul 2015 09:37:57 -0400 Subject: [PATCH] slice size should round up, not down --- pycuda/gpuarray.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pycuda/gpuarray.py b/pycuda/gpuarray.py index e2af905c..2161d78f 100644 --- a/pycuda/gpuarray.py +++ b/pycuda/gpuarray.py @@ -786,7 +786,7 @@ def __getitem__(self, index): array_stride = self.strides[array_axis] - new_shape.append((stop-start)//idx_stride) + new_shape.append((stop-start-1)//idx_stride+1) new_strides.append(idx_stride*array_stride) new_offset += array_stride*start