Skip to content

Indexing/slicing API #164

Description

@rnett

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'd like the usage to look something like:

tf.slice(x, Index.point(0), Index.all, Index.slice(0, 5, 2) // [0, :, 0:5::2]

tf.slice(x, Index.newaxis, Index.point(10, true), Index.elipses) // [tf.newaxis, 10:11, ...]

This would cover the assign variants, too.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions