openfl.pipelines.pipeline.Transformer

class openfl.pipelines.pipeline.Transformer

Bases: object

Base class for data transformation.

This class defines the basic structure of a data transformer. It should be subclassed when implementing new types of data transformations.

Methods

backward

Backward pass data transformation.

forward

Forward pass data transformation.

backward(data, metadata, **kwargs)

Backward pass data transformation.

Implement the data transformation needed when going the opposite direction to the forward method. This method should be overridden by all subclasses.

Parameters:
  • data – The transformed data.

  • metadata – The metadata for the transformation.

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

Returns:

transformed_data – The original data before the transformation.

forward(data, **kwargs)

Forward pass data transformation.

Implement the data transformation. This method should be overridden by all subclasses.

Parameters:
  • data – The data to be transformed.

  • **kwargs – Additional parameters to pass to the function

Returns:
  • transformed_data – The transformed data.

  • metadata – The metadata for the transformation.