serde.py 317 B

12345678910111213141516
  1. ## @package serde
  2. # Module caffe2.python.predictor.serde
  3. def serialize_protobuf_struct(protobuf_struct):
  4. return protobuf_struct.SerializeToString()
  5. def deserialize_protobuf_struct(serialized_protobuf, struct_type):
  6. deser = struct_type()
  7. deser.ParseFromString(serialized_protobuf)
  8. return deser