Implement cast support for ubyte and half#145
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? |
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 numpy/numpy-quaddtype#27