Filter

class Filter

Bases: ABC, Generic[T]

An abstract base class for basic, callable filters that receive and input and return a boolean tensor mask.

The usage of a filter extending this class will look something like this:

>>> f = SomeFilter()
>>> data = torch.tensor([1.000, 2.000, ...])
>>> mask = f(data)

mask, mask.dtype torch.tensor([False, True, …]), torch.bool

abstract __call__(input: T) BoolTensor

A filter function receiving N elements and returning which elements should be kept.

Parameters:

input (An input with N elements to be filtered) –

Return type:

A torch.BoolTensor of shape (N,), where N = len(input), and a value of True indicates that the respective row should be kept.