From 8b11ecbe911461a65584f072695d70a116e160bd Mon Sep 17 00:00:00 2001 From: John Kirkham Date: Mon, 10 Aug 2020 21:24:22 -0700 Subject: [PATCH] Assign `strides` from `iface` To simplify later checks and operations, go ahead and assign `strides`. --- ucp/_libs/utils.pyx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ucp/_libs/utils.pyx b/ucp/_libs/utils.pyx index ae90d53fc..b765d05f1 100644 --- a/ucp/_libs/utils.pyx +++ b/ucp/_libs/utils.pyx @@ -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)