Skip to content

How to load pickled xerus objects in C++?

This should be possible since pickle uses xerus::misc::serialize to serialize the object. However, I am not sure how to get to the data. For a simple tensor the following seems to work (pseudo code in python):

def load_pickled(fileName):
    with open(fileName, 'rb') as f:
        bytes = f.read()
    headerLength = bytes.index("Xerus xerus::")
    return xerus.deserialize(bytes[headerLength:])