[Mlir-commits] [mlir] [mlir][tensor] Fix runtime verification for tensor.extract_slice for empty tensor slices (PR #166569)

Slava Gurevich llvmlistbot at llvm.org
Thu Nov 6 19:52:40 PST 2025


noclowns wrote:

A pedantic comment about the comparison to numpy/python. 
Python/NumPy allows fully out-of-bounds slicing without throwing errors, so it's different, much looser semantics, than what you're seeking to implement. Your other points seem valid.

```
arr = np.arange(10)
empty = arr[15:4]  # returns [], valid or not
empty = arr[15:15]  # returns [], valid or not
clamped = arr[9:15] # returns [9], the out-of-bounds arg value is clamped
```

https://github.com/llvm/llvm-project/pull/166569


More information about the Mlir-commits mailing list