communication.serializer_plugins.torch module¶
(De)serialization logic for pytorch objects.
- communication.serializer_plugins.torch.register()[source]¶
Register pytorch serializer and deserializer.
- Return type:
None
- communication.serializer_plugins.torch.torch_deserialize_tensor(obj, opts)[source]¶
Function for deserializing pytorch tensors and loading them into cpu
- Parameters:
obj (
dict[str,Any] |bytes) – pytorch tensor to deserializeopts (
DeserializerOpts) – options to change the behaviour of the serialization.
- Return type:
Tensor- Returns:
deserialized tensor
- communication.serializer_plugins.torch.torch_serialize_tensor(obj, opts)[source]¶
Function for serializing pytorch tensors
- Parameters:
obj (
Tensor) – pytorch object to serializeopts (
SerializerOpts) – options to change the behaviour of the serialization.
- Return type:
tuple[int,...] |bytes- Returns:
serialized tensor