Slice index type

1 view
Skip to first unread message

Joel Berkeley

unread,
May 20, 2026, 11:38:50 PM (1 hour ago) May 20
to OpenXLA Discuss
Hi,

I want to find out about index types for tensor ops, in particular whether slice supports negative indexing, like numpy.

Why is the index type for slice is signed 64-bit int (I think that's what si64 and DenseI64ArrayAttr mean), despite the docs stating all args must be >0? Is it because

1. You don't support negative indices (like in numpy etc)
2. Other APIs do support negative indices (if so which ones?)
3. You want to use the same type everywhere for indices?



P.S. I think the docs for slice are subtly but confusingly wrong. They say "1-dimensional tensor constant of type si64", but I don't believe these are tensors, precisely because this isn't dynamic slicing. They're (MLIR?) arrays.

Best,
Joel

Joel Berkeley

unread,
May 20, 2026, 11:40:29 PM (1 hour ago) May 20
to OpenXLA Discuss, Joel Berkeley
To prevent confusion, I'm not requesting negative indexing. In fact it may be easier for me if it's NOT supported.
Reply all
Reply to author
Forward
0 new messages