mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
15 lines
405 B
Python
15 lines
405 B
Python
from __future__ import absolute_import
|
|
from __future__ import division
|
|
from __future__ import print_function
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
def serialize_protobuf_struct(protobuf_struct):
|
|
return protobuf_struct.SerializeToString()
|
|
|
|
|
|
def deserialize_protobuf_struct(serialized_protobuf, struct_type):
|
|
deser = struct_type()
|
|
deser.ParseFromString(serialized_protobuf)
|
|
return deser
|