Skip to content

Commit

Permalink
Assign strides from iface
Browse files Browse the repository at this point in the history
To simplify later checks and operations, go ahead and assign `strides`.
  • Loading branch information
jakirkham committed Aug 11, 2020
1 parent 79d7673 commit 8b11ecb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ucp/_libs/utils.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,9 @@ def get_buffer_nbytes(buffer, check_min_size, cuda_support):
shape = [int(s) for s in iface["shape"]]
nbytes = reduce(operator.mul, shape, 1) * itemsize
# Check that data is contiguous
if len(shape) > 0 and iface.get("strides") is not None:
strides = [int(s) for s in iface['strides']]
strides = iface.get("strides")
if len(shape) > 0 and strides is not None:
strides = [int(s) for s in strides]
if len(strides) != len(shape):
msg = "The length of shape and strides must be equal"
raise ValueError(msg)
Expand Down

0 comments on commit 8b11ecb

Please sign in to comment.