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

Custom dtype improvements #742

Merged
merged 1 commit into from
Oct 1, 2024
Merged

Custom dtype improvements #742

merged 1 commit into from
Oct 1, 2024

Conversation

wjakob
Copy link
Owner

@wjakob wjakob commented Oct 1, 2024

This commit generalizes the interface for registering custom dtypes with the nb::ndarray class. In particular, the previous version had hardcoded members like is_float, is_int, etc., which is not general enough to express nuances like bfloat16 or 8-bit FP types with different numbers of exponent and mantissa bits.

The new interface just lets the developer populate a nb::dlpack::dtype record manually and provide a type name for use in docstrings and error messages.

This commit generalizes the interface for registering custom dtypes with
the ``nb::ndarray`` class. In particular, the previous version had
hardcoded members like ``is_float``, ``is_int``, etc., which is not
general enough to express nuances like ``bfloat16`` or 8-bit FP types
with different numbers of exponent and mantissa bits.

The new interface just lets the developer populate a
``nb::dlpack::dtype`` record manually and provide a type name for use in
docstrings and error messages.
@wjakob wjakob merged commit 483c777 into master Oct 1, 2024
31 checks passed
@wjakob wjakob deleted the ndarray-dtype branch October 1, 2024 15:50
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