Class - TransformationPipeline#

class openfl.pipelines.pipeline.TransformationPipeline(transformers, **kwargs)[source]#

Bases: object

Data Transformer Pipeline Class.

This class is a pipeline of transformers that transform data in a sequential manner.

A sequential pipeline to transform (e.x. compress) data (e.x. layer of model_weights) as well as return metadata (if needed) for the reconstruction process carried out by the backward method.

transformers#

The list of transformers in the pipeline.

Type:

list

__init__(transformers, **kwargs)[source]#

Initialize TransformationPipeline.

Parameters:
  • transformers (list) – The list of transformers in the pipeline.

  • **kwargs – Additional keyword arguments for the pipeline.

Methods

__init__(transformers, **kwargs)

Initialize TransformationPipeline.

backward(data, transformer_metadata, **kwargs)

Backward pass of pipeline data transformer.

forward(data, **kwargs)

Forward pass of pipeline data transformer.

is_lossy()

If any of the transformers are lossy, then the pipeline is lossy.

backward(data, transformer_metadata, **kwargs)[source]#

Backward pass of pipeline data transformer.

Parameters:
  • data – The transformed data.

  • transformer_metadata – The metadata for the transformation.

  • **kwargs – Additional keyword arguments for the transformation.

Returns:

The original data before the transformation.

forward(data, **kwargs)[source]#

Forward pass of pipeline data transformer.

Parameters:
  • data – The data to be transformed.

  • **kwargs – Additional keyword arguments for the transformation.

Returns:

The transformed data. transformer_metadata: The metadata for the transformation.

Return type:

data

is_lossy()[source]#

If any of the transformers are lossy, then the pipeline is lossy.

Returns:

True if any of the transformers in the pipeline are lossy, False

otherwise.