npyjs
npyjs copied to clipboard
Raw access for float16
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,
I'd love to have a PR if you are willing to share, thank you!!
Nice, ill try to do that with a data test.