I need to slice array with arbitrary dimensions by two tuples. I can use slicing, such as a[1:3, 4:6]
. But what do i do if 1,3 and 4,6 are tuples?
While a[(1, 3)]
works, I tried a[(1, 3), (4, 6)]
and it didn't work, I think it ignores (4, 6). And I couldn't figure out how to make something like a[ t1[0] : t1[1], t2[0] : t2[1] ]
work depending on how many dimensions there are.
I'd like something like a[(1, 3):(4, 6)]
, that would also work for higher dimensions, e.g a[(1, 3, 2):(4, 6, 5)]