BCJRDecoder#
- class sionna.phy.fec.conv.BCJRDecoder(encoder: ConvEncoder | None = None, gen_poly: Tuple[str, ...] | None = None, rate: float = 0.5, constraint_length: int = 3, rsc: bool = False, terminate: bool = False, hard_out: bool = True, algorithm: str = 'map', precision: str | None = None, device: str | None = None, **kwargs)[source]#
Bases:
sionna.phy.block.BlockApplies BCJR decoding to a sequence of noisy codeword bits.
Implements the BCJR decoding algorithm [BCJR] that returns an estimate of the information bits for a noisy convolutional codeword. Takes as input channel LLRs and optional a priori LLRs. Returns an estimate of the information bits, either output LLRs (
hard_out= False) or hard decoded bits (hard_out= True), respectively.- Parameters:
encoder (ConvEncoder | None) – If
encoderis provided as input, the following input parameters are not required and will be ignored:gen_poly,rate,constraint_length,rsc,terminate. They will be inferred from theencoderobject itself. If None, the above parameters must be provided explicitly.gen_poly (Tuple[str, ...] | None) – Tuple of strings with each string being a 0,1 sequence. If None,
rateandconstraint_lengthmust be provided.rate (float) – Valid values are 1/3 and 1/2. Only required if
gen_polyis None.constraint_length (int) – Valid values are between 3 and 8 inclusive. Only required if
gen_polyis None.rsc (bool) – Boolean flag indicating whether the encoder is recursive-systematic for given generator polynomials. True indicates encoder is recursive-systematic. False indicates encoder is feed-forward non-systematic. Defaults to False.
terminate (bool) – Boolean flag indicating whether the codeword is terminated. True indicates codeword is terminated to all-zero state. False indicates codeword is not terminated. Defaults to False.
hard_out (bool) – Boolean flag indicating whether to output hard or soft decisions on the decoded information vector. True implies a hard-decoded information vector of 0/1’s as output. False implies output is decoded LLRs of the information. Defaults to True.
algorithm (str) – Indicates the implemented BCJR algorithm, where
'map'denotes the exact MAP algorithm,'log'indicates the exact MAP implementation but in log-domain, and'maxlog'indicates the approximated MAP implementation in log-domain where \(\log(e^{a}+e^{b}) \sim \max(a,b)\).precision (str | None) – Precision used for internal calculations and outputs. If None,
precisionis used.device (str | None) – Device for computation (e.g., ‘cpu’, ‘cuda:0’). If None,
deviceis used.
- Inputs:
llr_ch – […, n], torch.float. Tensor containing the (noisy) channel LLRs, where
ndenotes the codeword length.llr_a – […, k], None (default) | torch.float. Tensor containing the a priori information of each information bit. Implicitly assumed to be 0 if only
llr_chis provided.
- Outputs:
msghat – torch.float. Tensor of shape
[..., coderate*n]containing the estimates of the information bit tensor.
Examples
from sionna.phy.fec.conv import BCJRDecoder decoder = BCJRDecoder(rate=0.5, constraint_length=5) llr = torch.randn(10, 200) # Received LLRs u_hat = decoder(llr) print(u_hat.shape) # torch.Size([10, 100])
Attributes
- property trellis: sionna.phy.fec.conv.utils.Trellis#
Trellis object used during encoding.
Methods
- build(llr_ch_shape: torch.Size, **kwargs)[source]#
Build block and check dimensions.
- Parameters:
llr_ch_shape (torch.Size)