kaira.channels.BinaryErasureChannel

Inheritance diagram for BinaryErasureChannel
- class kaira.channels.BinaryErasureChannel(erasure_prob, erasure_symbol=-1, *args: Any, **kwargs: Any)[source]
Bases:
BaseChannelBinary Erasure Channel (BEC) with symbol erasure probability.
The Binary Erasure Channel is a channel model where bits are either received correctly or erased (lost) with probability p. It’s commonly used to model packet loss in communication systems [MacKay, 2003] [Richardson and Urbanke, 2008].
- Mathematical Model:
P(y=e|x=0) = P(y=e|x=1) = p (erasure probability) P(y=0|x=0) = P(y=1|x=1) = 1-p (correct transmission) P(y=1|x=0) = P(y=0|x=1) = 0 (no bit flips)
- Parameters:
Example
>>> channel = BinaryErasureChannel(erasure_prob=0.2) >>> x = torch.tensor([0, 1, 0, 1], dtype=torch.float32) >>> y = channel(x) # Some bits will be replaced with -1 (erasure)
Methods
Initialize the Binary Erasure Channel.
Apply Binary Erasure Channel errors to the input tensor.
Get a dictionary of the channel's configuration.
- __init__(erasure_prob, erasure_symbol=-1, *args: Any, **kwargs: Any)[source]
Initialize the Binary Erasure Channel.
- forward(x: Tensor, *args: Any, **kwargs: Any) Tensor[source]
Apply Binary Erasure Channel errors to the input tensor.
- Parameters:
x (torch.Tensor) – The input tensor (binary 0/1 or bipolar -1/1).
*args – Additional positional arguments (unused).
**kwargs – Additional keyword arguments (unused).
- Returns:
The output tensor with potential erasures.
- Return type: