syft.serde.compression

This file exists to provide one common place for all compression methods used in simplifying and serializing PySyft objects.

Module Contents

syft.serde.compression.NO_COMPRESSION = 40
syft.serde.compression.LZ4 = 41
syft.serde.compression.ZSTD = 42
syft.serde.compression.scheme_to_bytes
syft.serde.compression._apply_compress_scheme(decompressed_input_bin) → tuple

Apply the selected compression scheme. By default is used LZ4

Parameters

decompressed_input_bin – the binary to be compressed

syft.serde.compression.apply_lz4_compression(decompressed_input_bin) → tuple

Apply LZ4 compression to the input

Parameters

decompressed_input_bin – the binary to be compressed

Returns

a tuple (compressed_result, LZ4)

syft.serde.compression.apply_zstd_compression(decompressed_input_bin) → tuple

Apply ZSTD compression to the input

Parameters

decompressed_input_bin – the binary to be compressed

Returns

a tuple (compressed_result, ZSTD)

syft.serde.compression.apply_no_compression(decompressed_input_bin) → tuple

No compression is applied to the input

Parameters

decompressed_input_bin – the binary

Returns

a tuple (the binary, LZ4)

syft.serde.compression._compress(decompressed_input_bin: bin) → bin

This function compresses a binary using the function _apply_compress_scheme if the input has been already compressed in some step, it will return it as it is

Parameters

decompressed_input_bin (bin) – binary to be compressed

Returns

a compressed binary

Return type

bin

syft.serde.compression._decompress(binary: bin) → bin

This function decompresses a binary using the scheme defined in the first byte of the input

Parameters

binary (bin) – a compressed binary

Returns

decompressed binary

Return type

bin