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

Add preliminary support for the draft 2024.12 version of the standard #82

Merged
merged 11 commits into from
Nov 11, 2024

Conversation

asmeurer
Copy link
Member

@asmeurer asmeurer commented Nov 5, 2024

No description provided.

@asmeurer asmeurer requested a review from Copilot November 5, 2024 21:25
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 5 out of 10 changed files in this pull request and generated 1 suggestion.

Files not reviewed (5)
  • array_api_strict/_typing.py: Evaluated as low risk
  • array_api_strict/init.py: Evaluated as low risk
  • array_api_strict/tests/test_array_object.py: Evaluated as low risk
  • array_api_strict/tests/test_elementwise_functions.py: Evaluated as low risk
  • array_api_strict/_elementwise_functions.py: Evaluated as low risk

@@ -25,3 +26,14 @@ def take(x: Array, indices: Array, /, *, axis: Optional[int] = None) -> Array:
if x.device != indices.device:
raise ValueError(f"Arrays from two different devices ({x.device} and {indices.device}) can not be combined.")
return Array._new(np.take(x._array, indices._array, axis=axis), device=x.device)

@requires_api_version('2024.12')
def take_along_axis(x: Array, indices: Array, /, *, axis: int = -1) -> Array:
Copy link
Preview

Copilot AI Nov 5, 2024

Choose a reason for hiding this comment

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

The function take_along_axis should check that indices.dtype is in _integer_dtypes to ensure only integer indices are allowed.

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
@asmeurer
Copy link
Member Author

Going to merge and release this. This is all hidden behind a flag and warning, so even though this is still fairly untested, I think it's OK let people start playing with it.

I believe I have included every change to the draft standard since 2023.12. However, there are still some changes that are planned for 2024.12, but which aren't merged in the standard yet and which I haven't implemented here yet. The main one of interest is scalar support for array functions like where (see also #78). My plan is to implement this once there is an implementation in the standard.

@asmeurer asmeurer merged commit 838f7f4 into data-apis:main Nov 11, 2024
21 checks passed
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.

1 participant