Multiply#
- class deeptrack.features.Multiply(value: float | Callable[[...], float] = 0, **kwargs: Dict[str, Any])#
Bases:
ArithmeticOperationFeature
Multiply the input by a value.
This feature performs element-wise multiplication (*) of the input.
Parameters#
- valuePropertyLike[int or float], optional
The value to multiply the input. Defaults to 0.
- **kwargsAny
Additional keyword arguments passed to the parent constructor.
Example#
In this example, each element in the input array is multiplied by 5.
Start by creating a pipeline using Multiply:
>>> from deeptrack.features import Multiply, Value
>>> pipeline = Value([1, 2, 3]) >> Multiply(value=5) >>> pipeline.resolve() [5, 10, 15]
Equivalently, this pipeline can be created using:
>>> pipeline = Value([1, 2, 3]) * 5
>>> pipeline = 5 * Value([1, 2, 3])
Or, most explicitly:
>>> input_value = Value([1, 2, 3]) >>> sub_feature = Multiply(value=5) >>> pipeline = sub_feature(input_value)