aviramha/ormsgpack

Deserialization of np.array not working?

volkerjaenisch opened this issue · 1 comments

Hi!

This is what I get

type(ormsgpack.unpackb(ormsgpack.packb(np.array([[100,123]]), option=ormsgpack.OPT_SERIALIZE_NUMPY)))
<class 'list'>

and this I would expect.

type(ormsgpack.unpackb(ormsgpack.packb(np.array([[100,123]]), option=ormsgpack.OPT_SERIALIZE_NUMPY)))
<class 'numpy.ndarray'>

I am sure I did something stupid.
Any help appreciated

Volker

Hey @volkerjaenisch. Thanks for reporting it, you didn't do anything stupid at all.
The truth is that we conform to the msgpack specs, and the msgpack specs don't have any specs about numpy.
ormsgpack just translates arrays into msgpack types (in this case, array->list) in runtime.
The idea is that instead of doing the translation yourself or by using object hook, ormsgpack saves time doing it from Rust code without going back-and-forth from Python to native code.