Add#

class deeptrack.features.Add(b: Any | list[Any] | Callable[[...], Any | list[Any]] = 0, **kwargs: Any)#

Bases: ArithmeticOperationFeature

Add a value to the input.

This feature performs element-wise addition (+) to the input.

Parameters#

b: PropertyLike[Any | list[Any]], optional

The value to add to the input. Defaults to 0.

**kwargs: Any

Additional keyword arguments passed to the parent constructor.

Examples#

>>> import deeptrack as dt

Create a pipeline using Add:

>>> pipeline = dt.Value([1, 2, 3]) >> dt.Add(b=5)
>>> pipeline.resolve()
[6, 7, 8]

Alternatively, the pipeline can be created using operator overloading:

>>> pipeline = dt.Value([1, 2, 3]) + 5
>>> pipeline.resolve()
[6, 7, 8]

Or:

>>> pipeline = 5 + dt.Value([1, 2, 3])
>>> pipeline.resolve()
[6, 7, 8]

Or, more explicitly:

>>> input_value = dt.Value([1, 2, 3])
>>> sum_feature = dt.Add(b=5)
>>> pipeline = sum_feature(input_value)
>>> pipeline.resolve()
[6, 7, 8]