Skip to content

Commit

Permalink
Merge pull request #140 from hunse/numpy-strides
Browse files Browse the repository at this point in the history
Better checking for stride equality
  • Loading branch information
inducer committed Sep 12, 2016
2 parents a79f1d7 + be22d0c commit 1b80338
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions pyopencl/array.py
Expand Up @@ -38,6 +38,7 @@
as_strided as _as_strided,
f_contiguous_strides as _f_contiguous_strides,
c_contiguous_strides as _c_contiguous_strides,
equal_strides as _equal_strides,
ArrayFlags as _ArrayFlags,
get_common_dtype as _get_common_dtype_base)
from pyopencl.characterize import has_double_support
Expand Down Expand Up @@ -649,9 +650,7 @@ def set(self, ary, queue=None, async=False):
if not ary.flags.forc:
raise RuntimeError("cannot set from non-contiguous array")

ary = ary.copy()

if ary.strides != self.strides:
if not _equal_strides(ary.strides, self.strides, self.shape):
from warnings import warn
warn("Setting array from one with different "
"strides/storage order. This will cease to work "
Expand Down

0 comments on commit 1b80338

Please sign in to comment.