Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Array API tests fixes #636

Merged
merged 3 commits into from
Dec 5, 2024
Merged

Array API tests fixes #636

merged 3 commits into from
Dec 5, 2024

Conversation

tomwhite
Copy link
Member

@tomwhite tomwhite commented Dec 4, 2024

@tomwhite tomwhite added the tests label Dec 4, 2024
@@ -108,6 +108,8 @@ jobs:
# edge case failures (https://github.com/cubed-dev/cubed/issues/420)
array_api_tests/test_linalg.py::test_tensordot
array_api_tests/test_linalg.py::test_vecdot
# (getitem with negative step size is not implemented)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:) we actually rewrite such queries in Xarray for Zarr

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh interesting! How do you do that?

Copy link

@dcherian dcherian Dec 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/pydata/xarray/blob/99ee8c6ca54057a9b994d7685f36236f2d5a69d9/xarray/core/indexing.py#L1084 and friends. We rewrite the query to normal slice with +ve stride, then reverse in-memory after read :)

This is one of Xarray's magic tricks that very few people know about. We guarantee consistent indexing API over any array for the most part.

In pydata/xarray#8667, I suggested reusing this machinery for cubed.

EDIT: actually my comment is here: pydata/xarray#8834 (comment)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool. Would be great to reuse that. BTW Cubed flip is implemented in a similar way, but it's only step=-1 of course.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opened #637 to track

@tomwhite tomwhite force-pushed the array-api-tests-fixes branch from f49df7c to bee866c Compare December 5, 2024 14:36
@tomwhite tomwhite merged commit 83382e1 into main Dec 5, 2024
15 checks passed
@tomwhite tomwhite deleted the array-api-tests-fixes branch December 5, 2024 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants