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

Supports float16 as an opaque uint16 array #45

Closed
wants to merge 1 commit into from

Conversation

vallsv
Copy link

@vallsv vallsv commented Apr 17, 2024

Closes #44

This PR add support of npy file containing float16.

Float 16-bits is not supported in JavaScript as a TypedArray, but can be passed through javascript as an opaque memory and be used inside webgl.

So what we use instead a Uint16Array. This allow to match the right memory size and the right item indexing. This for example allow to use NdArray library for slicing.

In Javascript, the indexing also allow to read values as a bit field. This can be used to decode the value manually. See for example https://stackoverflow.com/a/8796597.

@j6k4m8
Copy link
Member

j6k4m8 commented Jan 13, 2025

Thank you @vallsv! This is now supported on v0.7.0 and later!

@j6k4m8 j6k4m8 closed this Jan 13, 2025
@vallsv
Copy link
Author

vallsv commented Jan 14, 2025

Thanks. Sounds fine for me too.

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.

Raw access for float16
2 participants