kaira.models.binary.soft_bit_thresholding.FixedThresholder

Inheritance diagram for FixedThresholder
- class kaira.models.binary.soft_bit_thresholding.FixedThresholder(threshold: float = 0.5, input_type: InputType = InputType.PROBABILITY, *args: Any, **kwargs: Any)[source]
Bases:
SoftBitThresholderSimple fixed threshold for soft bit values.
Applies a fixed threshold to convert soft bit values to hard decisions. For probability inputs (in range [0,1]), the default threshold is 0.5. For LLR inputs, the default threshold is 0.0.
Example
With threshold=0.5 and input [0.2, 0.7, 0.4, 0.9]: Output will be [0.0, 1.0, 0.0, 1.0]
Methods
Initialize the fixed thresholder.
Apply fixed thresholding to convert soft bit values to hard decisions.
Move the model to the specified device.
- __init__(threshold: float = 0.5, input_type: InputType = InputType.PROBABILITY, *args: Any, **kwargs: Any)[source]
Initialize the fixed thresholder.
- Parameters:
threshold – The threshold value to use. Default is 0.5 for probabilities.
input_type – Type of soft input, can be ‘prob’ (probabilities between 0 and 1) or ‘llr’ (log-likelihood ratios). Affects the default threshold if not specified.
*args – Variable positional arguments passed to the base class.
**kwargs – Variable keyword arguments passed to the base class.
- forward(x: Tensor, *args: Any, **kwargs: Any) Tensor[source]
Apply fixed thresholding to convert soft bit values to hard decisions.
- Parameters:
x – Input tensor of soft bit values.
*args – Additional positional arguments (unused).
**kwargs – Additional keyword arguments (unused).
- Returns:
Tensor of hard bit decisions (0.0 or 1.0).
- to(device: str | device, *args, **kwargs) SoftBitThresholder
Move the model to the specified device.
- Parameters:
device – The device to move the model to.
*args – Additional positional arguments for nn.Module.to().
**kwargs – Additional keyword arguments for nn.Module.to().
- Returns:
Self for method chaining.