-
-
Notifications
You must be signed in to change notification settings - Fork 9
Implement cast support for ubyte and half #145
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
Conversation
@SwayamInSync Does the version of C++ we use already have float16 support / what does numpy use so that I could also add casting support for float16? |
Here's where it happens in the stringdtype prototype:
You need to link against libnpymath to get the necessary C API: https://numpy.org/doc/stable/reference/c-api/coremath.html#half-precision-functions Here's where I handled that in the meson config: numpy-user-dtypes/stringdtype/meson.build Line 19 in b4a9429
|
The other problem, and probably why ubyte wasn't added earlier, is that ubyte and bool alias but need different code paths. Not sure how to fix that ... |
@SwayamInSync @ngoldbaum I think everything should work now, what do you think? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Implement cast support for ubyte Use template magic to distinguish npy_bool and npy_half Implement cast support for half
Thanks for doing this @juntyr! |
BTW if needed then in this SwayamInSync#13 I wrote the workaround to get an "Non-Implemented" error instead of segfault crash. |
Ah, I missed that - can you send it in as a followup PR? |
Fixes #144