You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you want to index a tensor currently your only choice is strided_slice or slice, neither of which have good APIs.
I'd like to create an indexing API that supports point indices, slices, strided slices, ellipses, all, and newaxis. This isn't particularly hard to do by using strided_slice, I already have a similar Kotlin API I can port. This will also port well to the Kotlin API, especially with the rangeTo operator.
I'm now trying to unify the Operand indexing with ndarray indexing. The basic differences and what I'd like to do to resolve them are:
Operand doesn't (and can't) support hyperslab or seq. It's easy enough to keep them and use types to forbid using them on tensors. How useful are they though? They don't match Python slicing and it would make things a little cleaner to remove them.
NDArray indexing needs to support newaxis, ellipsis, and strided slice. None of this is particularly hard, as of the lasted commit to my PR it's there, if untested and probably buggy.
There's lots of NDArray index classes that can be done using the new strided slice. Even, Flip, Odd, From, To, Range, Step, and All are all doable as strided slices (::2, ::-1, 1::2, n:, :n, n:m, ::k, :). I don't see any reason to keep them, their methods in Indices could just use slice (I'd add checks for performance).
More minor changes:
I'd like to rename the builder class to Index. Imo Index.point() reads better than Indices.point().
The StridedSlice op supports a point index without removing the dimension, NDArray should as well.
If you want to index a tensor currently your only choice is
strided_slice
orslice
, neither of which have good APIs.I'd like to create an indexing API that supports point indices, slices, strided slices, ellipses, all, and newaxis. This isn't particularly hard to do by using
strided_slice
, I already have a similar Kotlin API I can port. This will also port well to the Kotlin API, especially with therangeTo
operator.I'd like the usage to look something like:
This would cover the assign variants, too.
The text was updated successfully, but these errors were encountered: