Open colinator opened 1 month ago
@colinator , is is possible to serialize and deserialize bytestrings using this library for formats that support this (msgpack, flexbuffers, CBOR, BSON):
https://github.com/getml/reflect-cpp/blob/main/docs/bytestring.md
You could just implement your own custom parser for your tensors:
https://github.com/getml/reflect-cpp/blob/main/docs/custom_parser.md
In this case you would use using ReflType = rfl::Bytestring
and then implement the to
and from
methods that would load the byte string from and to your tensors.
Thanks! I will give it a try.
Now I'm not so sure that byte strings (or deserialization/serialization in general) works with '0-copy'. Meaning, if I have some data 'in hand' from the network, for example - a sequence of bytes that represents a flex-buffer-encoded thing, I want to get a structure such that accessing a variable (or calling a function to get something) from the structure points into the flex buffer-encoded data, without copying the data. In this way I can get true '0-copy': I can turn some bytes from the network, for example, into a 'live' struct with no copying. Maybe I'm missing how to do it...
Would it be possible to add support for tensor serialization/deserialization? i.e. things like xtensor or eigen? Ideally these would have a '0-copy' ability - you could deserialize the memory directly into the tensor... or maybe just a '0-copy bytestring'? Do byte strings work that way now? Then tensor support could be grafted independently then... right?