Multiply#

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

Bases: ArithmeticOperationFeature

Multiply the input by a value.

This feature performs element-wise multiplication (*) of the input.

Parameters#

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

The value to multiply the input. Defaults to 0.

**kwargs: Any

Additional keyword arguments passed to the parent constructor.

Examples#

>>> import deeptrack as dt

Start by creating a pipeline using Multiply:

>>> pipeline = dt.Value([1, 2, 3]) >> dt.Multiply(b=5)
>>> pipeline.resolve()
[5, 10, 15]

Alternatively, this pipeline can be created using:

>>> pipeline = dt.Value([1, 2, 3]) * 5
>>> pipeline.resolve()
[5, 10, 15]

Or:

>>> pipeline = 5 * dt.Value([1, 2, 3])
>>> pipeline.resolve()
[5, 10, 15]

Or, more explicitly:

>>> input_value = dt.Value([1, 2, 3])
>>> mul_feature = dt.Multiply(b=5)
>>> pipeline = mul_feature(input_value)
>>> pipeline.resolve()
[5, 10, 15]