-
Notifications
You must be signed in to change notification settings - Fork 234
Closed
Labels
DocArray v2This issue is part of the rewrite; not to be merged into mainThis issue is part of the rewrite; not to be merged into main
Description
PyTorch (and numpy, too) supports a rich and flexible indexing API: https://pytorch.org/cppdocs/notes/tensor_indexing.html
DocumentArrayStacked should support the same.
Concretely, we should be able to do the following:
da = DocumentArray([... for _ in range(5)]
da[0] # index by offset; returns doc at this position
da[0:5:2] # index by slice; returns every other doc
da[0, 1, 2] # index by sequence of positions; returns DocumentArray with docs at these positions
da[[0, 1, 2]] # same as above
da[[True, False, True, True, False]] # index by boolean mask; returns DocumentArray with "True" docs
da[None] # returns `da`, just to conform with PyTorch conventionMetadata
Metadata
Assignees
Labels
DocArray v2This issue is part of the rewrite; not to be merged into mainThis issue is part of the rewrite; not to be merged into main
Type
Projects
Status
Done