Module tripleblind.converters

Converter utilities for working with various frameworks.

Classes

class TorchEncoder

Converter for working with PyTorch Tensors

Static methods

def decode(tensor_string: str) -> torch.Tensor

Decode a text string to a tensor

Args

tensor_string : str
A base64 encoded tensor

Returns

torch.Tensor
The decoded PyTorch tensor
def encode(tensor: torch.Tensor) -> str

Encode a tensor to a text string

Args

tensor : torch.Tensor
A PyTorch tensor

Returns

str
A base64 encoding of the tensor