Sinh#
- class deeptrack.elementwise.Sinh(feature: Feature | None = None, **kwargs: Any)#
Bases:
ElementwiseFeatureApply the hyperbolic sine function elementwise.
This feature applies xp.sinh 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 hyperbolic sine 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 Sinh
Use with NumPy directly:
>>> import numpy as np >>> >>> result = Sinh()(np.array([-1.0, 0.0, 1.0])) >>> result array([-1.17520119, 0. , 1.17520119])
Use with PyTorch directly:
>>> import torch >>> >>> result = Sinh()(torch.tensor([-1.0, 0.0, 1.0])) >>> result tensor([-1.1752, 0.0000, 1.1752])
Use in a pipeline with a NumPy value:
>>> value = dt.Value(value=np.array([-1.0, 0.0, 1.0])) >>> pipeline = value >> Sinh() >>> result = pipeline() >>> result array([-1.17520119, 0. , 1.17520119])
Use in a pipeline with a PyTorch value:
>>> value = dt.Value(value=torch.tensor([-1.0, 0.0, 1.0])) >>> pipeline = value >> Sinh() >>> result = pipeline() >>> result tensor([-1.1752, 0.0000, 1.1752])
These are equivalent to:
>>> pipeline = Sinh(value)