Skip to content

Support outer and vectorized indexing in ArrayApiIndexingAdapter - #11991

Open
dineshjingar2001 wants to merge 3 commits into
pydata:mainfrom
dineshjingar2001:fix-array-api-indexing-8667
Open

dineshjingar2001 wants to merge 3 commits into
pydata:mainfrom
dineshjingar2001:fix-array-api-indexing-8667

Conversation

@dineshjingar2001

Copy link
Copy Markdown

Description

Fixes outer and vectorized indexing on strict Python Array API arrays in ArrayApiIndexingAdapter:

  • Convert duck-array indexers to the target array namespace and device via xp.asarray(..., device=...).
  • Use xp.take per axis in _oindex_get (handling 0-D index arrays via reshape/squeeze), since the Array API standard disallows mixing slices and integer index arrays in __getitem__.
  • Implement _vindex_get for Array API >= 2024.12 by expanding and converting slice axes with _arrayize_vectorized_indexer, raising a clear TypeError for older Array API versions.
  • Convert assigned values to the target namespace/device in __setitem__, _oindex_set, and _vindex_set, raising a clear TypeError when a strict Array API implementation disallows integer-array __setitem__.

Checklist

AI Disclosure

  • This PR contains AI-generated content.
    • I have tested any AI-generated content in my PR.
    • I take responsibility for any AI-generated content in my PR.
      Tools: Google Antigravity (assisted with ArrayApiIndexingAdapter implementation and array_api_strict test cases; reviewed and tested locally).

@welcome

welcome Bot commented Dec 5, 2026

Copy link
Copy Markdown

Thank you for opening this pull request! It may take us a few days to respond here, so thank you for being patient.
If you have questions, some answers may be found in our contributing guidelines.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error using vectorized indexing with array API compliant class

1 participant