kaira.models.binary.soft_bit_thresholding.RepetitionSoftBitDecoder

Inheritance diagram for RepetitionSoftBitDecoder
- class kaira.models.binary.soft_bit_thresholding.RepetitionSoftBitDecoder(repetition_factor: int = 3, soft_combine_method: str = 'mean', thresholder: SoftBitThresholder | None = None, input_type: InputType = InputType.PROBABILITY, *args: Any, **kwargs: Any)[source]
Bases:
BaseModelEnhanced decoder for repetition coding with flexible soft bit processing.
This decoder processes repeated soft bit values with various thresholding techniques. It supports multiple soft input types and different methods for combining repeated values.
Example
With repetition_factor=3, soft_combine_method=’mean’, and thresholder=FixedThresholder: Input [0.2, 0.3, 0.1, 0.8, 0.7, 0.9] becomes [0.0, 1.0]
Methods
Initialize the repetition soft bit decoder.
Decode the input tensor using soft bit processing.
Create model instance from configuration.
Create model from Hydra DictConfig.
Create model from Hugging Face PretrainedConfig.
- __init__(repetition_factor: int = 3, soft_combine_method: str = 'mean', thresholder: SoftBitThresholder | None = None, input_type: InputType = InputType.PROBABILITY, *args: Any, **kwargs: Any)[source]
Initialize the repetition soft bit decoder.
- Parameters:
repetition_factor – Number of times each bit was repeated. Must be a positive integer.
soft_combine_method – Method to combine repeated soft values (‘mean’, ‘sum’, ‘median’, ‘max’).
thresholder – Optional custom thresholder. If None, uses FixedThresholder with appropriate defaults.
input_type – Type of soft input (‘prob’, ‘llr’).
*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]
Decode the input tensor using soft bit processing.
- Parameters:
x – Input tensor of shape (batch_size, encoded_length), where encoded_length = original_message_length * repetition_factor. Contains soft bit values.
*args – Additional positional arguments (passed to thresholder).
**kwargs – Additional keyword arguments (passed to thresholder).
- Returns:
Decoded binary tensor of shape (batch_size, encoded_length // repetition_factor)
- classmethod from_config(config, **kwargs)
Create model instance from configuration.
- Parameters:
config – Configuration object (PretrainedConfig, DictConfig, or dict)
**kwargs – Additional parameters to override config
- Returns:
Model instance
- classmethod from_hydra_config(config: DictConfig, **kwargs)
Create model from Hydra DictConfig.
- Parameters:
config – Hydra configuration
**kwargs – Additional parameters
- Returns:
Model instance
- classmethod from_pretrained_config(config: PretrainedConfig, **kwargs)
Create model from Hugging Face PretrainedConfig.
- Parameters:
config – PretrainedConfig instance
**kwargs – Additional parameters
- Returns:
Model instance