Filter

class tfdatacompose.filter.filter.Filter

Base class for Filtering operations

Wraps the Tensorflow Filter operation on the dataset. The filtering operation should be implemented in the filter method.

apply(dataset) → DatasetV1

Applies the operation on the given dataset and returns the new dataset.

Parameters:

dataset – Tensorflow Dataset The dataset to change

Returns:

Tensorflow Dataset The changed dataset

abstract filter(*args) → bool

Implement the filtering in this method. The method receives an element of the dataset as input and should return a boolean. You can change the arguments of this method to retrieve the inner element of tuples if your dataset elements are tuples. Example: map(self, x: int, y:int) -> bool

Parameters:

args – the dataset element.

Returns:

True to keep an element and False to remove it