Skip to content
This repository was archived by the owner on Sep 9, 2026. It is now read-only.

feat: advanced indexing - #1074

Merged
JohannesMessner merged 24 commits into
feat-rewrite-v2from
feat-advanced-indexing
Feb 7, 2023
Merged

JohannesMessner merged 24 commits into
feat-rewrite-v2from
feat-advanced-indexing

Conversation

@JohannesMessner

@JohannesMessner JohannesMessner commented Feb 2, 2023

Copy link
Copy Markdown
Member

Goals:

PyTorch like indexing into DocumentArray and DocumentArrayStacked

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 convention

This also includes a refactor where in DocumentArrayStacked ._columns is now separated into _doc_columns and _tensor_columns, instead of having both types in the same dict. It makes everything a bit clearer.

closes #1073

@JohannesMessner JohannesMessner added the DocArray v2 This issue is part of the rewrite; not to be merged into main label Feb 2, 2023
@JohannesMessner JohannesMessner self-assigned this Feb 2, 2023
@JohannesMessner
JohannesMessner changed the base branch from main to feat-rewrite-v2 February 2, 2023 14:11
Comment thread docarray/array/array.py Outdated
Signed-off-by: Johannes Messner <[email protected]>
Signed-off-by: Johannes Messner <[email protected]>
Signed-off-by: Johannes Messner <[email protected]>
Signed-off-by: Johannes Messner <[email protected]>
Signed-off-by: Johannes Messner <[email protected]>
@JohannesMessner
JohannesMessner marked this pull request as ready for review February 3, 2023 16:26
Comment thread docarray/array/array.py Outdated
Comment thread docarray/array/array.py Outdated
Signed-off-by: Johannes Messner <[email protected]>
@github-actions github-actions Bot added size/l and removed size/m labels Feb 6, 2023
@JoanFM

JoanFM commented Feb 6, 2023

Copy link
Copy Markdown
Member

Would u mind adding a description of what it enables?

Signed-off-by: Johannes Messner <[email protected]>
Signed-off-by: Johannes Messner <[email protected]>
Signed-off-by: Johannes Messner <[email protected]>
Signed-off-by: Johannes Messner <[email protected]>
Comment thread docarray/array/array_stacked.py
@JohannesMessner JohannesMessner mentioned this pull request Feb 7, 2023
47 tasks
Signed-off-by: Johannes Messner <[email protected]>
Signed-off-by: Johannes Messner <[email protected]>
@github-actions github-actions Bot added size/xl and removed size/l labels Feb 7, 2023
@github-actions

github-actions Bot commented Feb 7, 2023

Copy link
Copy Markdown

This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

Signed-off-by: Johannes Messner <[email protected]>
@github-actions

github-actions Bot commented Feb 7, 2023

Copy link
Copy Markdown

This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

@github-actions

github-actions Bot commented Feb 7, 2023

Copy link
Copy Markdown

📝 Docs are deployed on https://ft-feat-advanced-indexing--jina-docs.netlify.app 🎉

@JohannesMessner
JohannesMessner merged commit de8f70e into feat-rewrite-v2 Feb 7, 2023
@JohannesMessner
JohannesMessner deleted the feat-advanced-indexing branch February 7, 2023 10:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

toch/np like indexig for DocumentArrayStacked

4 participants