Skip to content

Do not require default dtype if no dtypes in kind supported #337

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

Merged
merged 1 commit into from
Jan 31, 2025

Conversation

adityagoel4512
Copy link
Contributor

@adityagoel4512 adityagoel4512 commented Jan 29, 2025

The description of __array_namespace_info__'s default_dtypes method requires that you return a default dtype for all the keys specified.

The test suite here allows you to skip certain dtypes using the ARRAY_API_TESTS_SKIP_DTYPES environment variable. This means that it's possible to omit all the dtypes for a given kind. We use this in ndonnx to skip all complex dtypes since we're not able to support them at this time. In such a context, a default for "complex floating" doesn't make much sense.

I would like to only check the default_dtypes keys are present for kinds where we haven't skipped all the relevant dtypes. An alternative could be to make the value of the dictionary an optional dtype | None in a future version of the standard. I'd be happy with either option.

@ev-br
Copy link
Member

ev-br commented Jan 29, 2025

This seems to overlap with #313, could you relate the approaches @adityagoel4512 @cbourjau ?

@cbourjau
Copy link
Contributor

The PRs seem tangential, but I think both PRs make sense in their own right. In the light of skipping complex types with ARRAY_API_TESTS_SKIP_DTYPES it makes sense to test the other properties of __array_namespace_info__. However, an implementation without complex data types is not standard compliant, but that is not true for all data types that can be skipped with ARRAY_API_TESTS_SKIP_DTYPES. Could you add a new test case that checks for complex data types and fails regardless of ARRAY_API_TESTS_SKIP_DTYPES?

@adityagoel4512
Copy link
Contributor Author

but that is not true for all data types that can be skipped with ARRAY_API_TESTS_SKIP_DTYPES.

What data type is this statement true for?

@cbourjau
Copy link
Contributor

What data type is this statement true for?

I was under the impression that some of the "nonessential" data types were optional, but that is actually not the case. In that light, I think this PR looks good as it standards!

@ev-br ev-br merged commit dad7731 into data-apis:master Jan 31, 2025
3 checks passed
@ev-br
Copy link
Member

ev-br commented Jan 31, 2025

Thanks @adityagoel4512

@adityagoel4512 adityagoel4512 deleted the skip-unused-kinds-in-default branch January 31, 2025 10:05
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.

3 participants