sdd / kiddo

Kiddo
Apache License 2.0
85 stars 14 forks source link

Feature request: support of 'half' crate. #105

Closed rendarz closed 6 months ago

rendarz commented 9 months ago

The support of 'fixed' crate has been very useful and forward-looking. Now, there is another very popular crate: half. This crate implements half-sized floats, i.e. 16-bit floats which follow the IEEE754 standard. It would be very helpful (and unique in the world) if kiddo would support types such as half::F16 and half::BF16. Thank you for your time, and your awesome project! Keep it on!

sdd commented 9 months ago

Great idea! I think this should be fairly straightforward, and I can gate it behind a feature. I'll look at doing f128 in a similar way, if it is feasible.

Thanks for the suggestion, and the encouragement! 👍🏼

sdd commented 9 months ago

Hi Marco,

It looks like Kiddo may already support f16 out-of-the-box with no changes required! You need to enable the num-traits feature of the half crate in order to get it to work.

See the example here: https://github.com/sdd/kiddo/pull/110/files#diff-c5a8e5aa531111094cd34349e31759268e663e8a937f5004aefc395fb3a30f55

I've not tested this extensively. Give it a try, and if you run into any issues, let me know and I'll see if I can help.

rendarz commented 9 months ago

This is a great news! I will test it, thanks!

sdd commented 6 months ago

Support added in v4.2.0