Polar5GDecoder#
- class sionna.phy.fec.polar.Polar5GDecoder(enc_polar: sionna.phy.fec.polar.encoding.Polar5GEncoder, dec_type: str = 'SC', list_size: int = 8, num_iter: int = 20, return_crc_status: bool = False, *, precision: str | None = None, device: str | None = None, **kwargs)[source]#
Bases:
sionna.phy.block.BlockWrapper for 5G compliant decoding including rate-recovery and CRC removal.
- Parameters:
enc_polar (sionna.phy.fec.polar.encoding.Polar5GEncoder) – Instance of the
Polar5GEncoderused for encoding including rate-matching.dec_type (str) – Defining the decoder to be used. Must be one of {“SC”, “SCL”, “hybSCL”, “BP”}.
list_size (int) – Defining the list size iff list-decoding is used. Only required for
dec_types{“SCL”, “hybSCL”}.num_iter (int) – Defining the number of BP iterations. Only required for
dec_type“BP”.return_crc_status (bool) – If True, the decoder additionally returns the CRC status indicating if a codeword was (most likely) correctly recovered.
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 channel logits/llr values.
- Outputs:
b_hat – […, k], torch.float. Binary tensor containing hard-decided estimations of all k information bits.
crc_status – […], torch.bool. CRC status indicating if a codeword was (most likely) correctly recovered. This is only returned if
return_crc_statusis True. Note that false positives are possible.
Notes
This block supports the uplink and downlink Polar rate-matching scheme without codeword segmentation.
Although the decoding list size is not provided by 3GPP [3GPPTS38212], the consortium has agreed on a list size of 8 for the 5G decoding reference curves [Bioglio_Design].
All list-decoders apply CRC-aided decoding, however, the non-list decoders (“SC” and “BP”) cannot materialize the CRC leading to an effective rate-loss.
Examples
import torch from sionna.phy.fec.polar import Polar5GEncoder, Polar5GDecoder k, n = 100, 200 encoder = Polar5GEncoder(k, n) decoder = Polar5GDecoder(encoder, dec_type="SCL", list_size=8) bits = torch.randint(0, 2, (10, k), dtype=torch.float32) codewords = encoder(bits) llr_ch = 20.0 * (2.0 * codewords - 1) # BPSK without noise decoded = decoder(llr_ch) print(torch.equal(bits, decoded)) # True
Attributes
- property polar_dec#
Decoder instance used for decoding.
Methods