diff --git a/pyopencl/array.py b/pyopencl/array.py index 9b28f17b103a6e9d896c7d80d4352b2788e76536..2d61e3e13232273db5aff913c5d57598e4a5002d 100644 --- a/pyopencl/array.py +++ b/pyopencl/array.py @@ -1173,6 +1173,10 @@ class Array(object): # TODO: add more error-checking, perhaps if isinstance(shape[0], tuple) or isinstance(shape[0], list): shape = tuple(shape[0]) + + if shape == self.shape: + return self + size = reduce(lambda x, y: x * y, shape, 1) if size != self.size: raise ValueError("total size of new array must be unchanged")