FloorDivide#

class deeptrack.features.FloorDivide(value: float | Callable[[...], float] = 0, **kwargs: Dict[str, Any])#

Bases: ArithmeticOperationFeature

Divide the input with a value.

This feature performs element-wise floor division (//) of the input.

Floor division produces an integer result when both operands are integers, but truncates towards negative infinity when operands are floating-point numbers.

Parameters#

valuePropertyLike[int or float], optional

The value to floor-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 floor-divided by 5.

Start by creating a pipeline using FloorDivide:

>>> from deeptrack.features import FloorDivide, Value
>>> pipeline = Value([-3, 3, 6]) >> FloorDivide(value=5)
>>> pipeline.resolve()
[0.2 0.4 0.6]

Equivalently, this pipeline can be created using:

>>> pipeline = Value([-3, 3, 6]) // 5
>>> pipeline = 5 // Value([-3, 3, 6])  # Different result.

Or, most explicitly:

>>> input_value = Value([-3, 3, 6])
>>> floordiv_feature = FloorDivide(value=5)
>>> pipeline = floordiv_feature(input_value)