Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork15
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
juntyr commentedSep 7, 2025
@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? |
ngoldbaum commentedSep 7, 2025
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:
|
juntyr commentedSep 7, 2025
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 ... |
juntyr commentedSep 8, 2025
@SwayamInSync@ngoldbaum I think everything should work now, what do you think? |
SwayamInSync left a comment
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
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Implement cast support for ubyteUse template magic to distinguish npy_bool and npy_halfImplement cast support for half
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
ngoldbaum commentedSep 9, 2025
Thanks for doing this@juntyr! |
77d4406 intonumpy:mainUh oh!
There was an error while loading.Please reload this page.
SwayamInSync commentedSep 9, 2025
BTW if needed then in thisSwayamInSync#13 I wrote the workaround to get an "Non-Implemented" error instead of segfault crash. |
ngoldbaum commentedSep 9, 2025
Ah, I missed that - can you send it in as a followup PR? |
Uh oh!
There was an error while loading.Please reload this page.
Fixes#144