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

Raw access for float16 #44

Open
vallsv opened this issue Apr 16, 2024 · 2 comments · May be fixed by #45
Open

Raw access for float16 #44

vallsv opened this issue Apr 16, 2024 · 2 comments · May be fixed by #45

Comments

@vallsv
Copy link

vallsv commented Apr 16, 2024

Hi,

I am using your library for fast prototyping.

It was very convenient to use but i had to patch it to read float16.

float16 is not supported by js, but is supported by webgl. So this allow to fetch the data as an opaque manner, the shape remains the same, and the result is anyway typed with dtype==='float16'.

I also use some wrapper to read float16 values in js, but i think it is not really needed at this stage.

Anyway, here is setup.

import _npyjs from 'npyjs';

const npyjs = new _npyjs();

// Supports float16 as uint16
npyjs.dtypes['<f2'] = {
  name: 'float16',
  size: 16,
  arrayConstructor: Uint16Array,
};

Tell me if you prefer to have a PR.
Regards,

@j6k4m8
Copy link
Member

j6k4m8 commented Apr 16, 2024

I'd love to have a PR if you are willing to share, thank you!!

@vallsv
Copy link
Author

vallsv commented Apr 17, 2024

Nice, ill try to do that with a data test.

@vallsv vallsv linked a pull request Apr 17, 2024 that will close this issue
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 a pull request may close this issue.

2 participants