Divide#
- class deeptrack.features.Divide(value: float | Callable[[...], float] = 0, **kwargs: Dict[str, Any])#
Bases:
ArithmeticOperationFeature
Divide the input with a value.
This feature performs element-wise division (/) of the input.
Parameters#
- valuePropertyLike[int or float], optional
The value to divide 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 divided by 5.
Start by creating a pipeline using Divide:
>>> from deeptrack.features import Divide, Value
>>> pipeline = Value([1, 2, 3]) >> Divide(value=5) >>> pipeline.resolve() [0.2 0.4 0.6]
Equivalently, this pipeline can be created using:
>>> pipeline = Value([1, 2, 3]) / 5
>>> pipeline = 5 / Value([1, 2, 3]) # Different result.
Or, most explicitly:
>>> input_value = Value([1, 2, 3]) >>> truediv_feature = Divide(value=5) >>> pipeline = truediv_feature(input_value)