Log10#
- class deeptrack.elementwise.Log10(feature: Feature | None = None, **kwargs: Any)#
Bases:
ElementwiseFeatureApply the base-10 logarithm function elementwise.
This feature applies xp.log10 to each element in a NumPy array or a PyTorch tensor. It supports both direct input and pipeline composition.
The input must be strictly positive. Passing zero or negative values will return -inf or NaN, and may raise warnings or errors depending on the backend.
Parameters#
- feature: Feature | None, optional
The input feature to which the logarithm function with base 10 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 Log10
Use with NumPy directly:
>>> import numpy as np >>> result = Log10()(np.array([1.0, 10.0, 100.0])) >>> result array([0., 1., 2.])
Use with PyTorch directly:
>>> import torch >>> result = Log10()(torch.tensor([1.0, 10.0, 100.0])) >>> result tensor([0., 1., 2.])
Use in a pipeline with a NumPy value:
>>> value = dt.Value(value=np.array([1.0, 10.0, 100.0])) >>> pipeline = value >> Log10() >>> result = pipeline() >>> result array([0., 1., 2.])
Use in a pipeline with a PyTorch value:
>>> value = dt.Value(value=torch.tensor([1.0, 10.0, 100.0])) >>> pipeline = value >> Log10() >>> result = pipeline() >>> result tensor([0., 1., 2.])
These are equivalent to:
>>> pipeline = Log10(value)