Arctan#
- class deeptrack.elementwise.Arctan(feature: Feature | None = None, **kwargs: Any)#
Bases:
ElementwiseFeatureApply the arctangent function elementwise.
This feature applies xp.arctan to each element in a NumPy array or a PyTorch tensor. It supports both direct input and pipeline composition.
Parameters#
- feature: Feature | None, optional
The input feature to which the arctangent function will be applied. If None, the function is applied directly to the input array or tensor.
Examples#
>>> import deeptrack as dt >>> from deeptrack.elementwise import Arctan
Use with NumPy directly:
>>> import numpy as np >>> >>> result = Arctan()(np.array([-1.0, 0.0, 1.0])) >>> result array([-0.78539816, 0. , 0.78539816])
Use with PyTorch directly:
>>> import torch >>> >>> result = Arctan()(torch.tensor([-1.0, 0.0, 1.0])) >>> result tensor([-0.7854, 0.0000, 0.7854])
Use in a pipeline with a NumPy value:
>>> value = dt.Value(value=np.array([-1.0, 0.0, 1.0])) >>> pipeline = value >> Arctan() >>> result = pipeline() >>> result array([-0.78539816, 0. , 0.78539816])
Use in a pipeline with a PyTorch value:
>>> value = dt.Value(value=torch.tensor([-1.0, 0.0, 1.0])) >>> pipeline = value >> Arctan() >>> result = pipeline() >>> result tensor([-0.7854, 0.0000, 0.7854])
These are equivalent to:
>>> pipeline = Arctan(value)