syft.serde.msgpack

Package Contents

syft.serde.msgpack.proto_type_info(cls)

Returns TypeInfo instance for a given class identified by cls parameter. Throws an exception when such class does not exists in the proto.json.

syft.serde.msgpack.serialize(obj: object, worker: AbstractWorker = None, simplified: bool = False, force_full_simplification: bool = False) → bin

This method can serialize any object PySyft needs to send or store.

This is the high level function for serializing any object or collection of objects which PySyft needs to send over the wire. It includes three steps, Simplify, Serialize, and Compress as described inline below.

Parameters
  • obj (object) – the object to be serialized

  • simplified (bool) – in some cases we want to pass in data which has already been simplified - in which case we must skip double simplification - which would be bad…. so bad… so… so bad

  • force_full_simplification (bool) – Some objects are only partially serialized by default. For objects where this is the case, setting this flag to True will force the entire object to be serialized. For example, setting this flag to True will cause a VirtualWorker to be serialized WITH all of its tensors while by default VirtualWorker objects only serialize a small amount of metadata.

Returns

the serialized form of the object.

Return type

binary

syft.serde.msgpack.deserialize(binary: bin, worker: AbstractWorker = None) → object