Skip to content

Commit

Permalink
Fix contiguous check
Browse files Browse the repository at this point in the history
  • Loading branch information
okuta committed Jul 26, 2017
1 parent cd45523 commit 93cdee0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions cupy/core/core.pyx
Expand Up @@ -1549,10 +1549,13 @@ cdef class ndarray:
arr.dtype, self.dtype))
if self.shape != arr.shape:
raise ValueError('Shape mismatch')
if not self._c_contiguous:
if self._c_contiguous:
arr = numpy.ascontiguousarray(arr)
elif self._f_contiguous:
arr = numpy.asfortranarray(arr)
else:
raise RuntimeError('Cannot set to non-contiguous array')

arr = numpy.ascontiguousarray(arr)
ptr = arr.ctypes.get_as_parameter()
if stream is None:
self.data.copy_from_host(ptr, self.nbytes)
Expand Down

0 comments on commit 93cdee0

Please sign in to comment.