Skip to content

Commit 2bc963d

Browse files
cpcloudcursoragent
andcommitted
Document explicit stride requirement in DLPack export helper.
Clarify why setup_dl_tensor_layout always sets a non-NULL stride pointer for non-scalar exports under DLPack v1.2+ semantics. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent b0f34aa commit 2bc963d

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

cuda_core/cuda/core/_dlpack.pyx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ cdef inline int setup_dl_tensor_layout(DLTensor* dl_tensor, object buf) except -
7979
<int64_t*>stdlib.malloc(sizeof(int64_t) * 2)
8080
if shape_strides == NULL:
8181
raise MemoryError()
82+
# DLPack v1.2+ requires non-NULL strides for ndim != 0.
8283
shape_strides[0] = <int64_t>buf.size
8384
shape_strides[1] = 1
8485
dl_tensor.shape = shape_strides

0 commit comments

Comments
 (0)