CRCDecoder#
- class sionna.phy.fec.crc.CRCDecoder(crc_encoder: sionna.phy.fec.crc.CRCEncoder, *, precision: str | None = None, device: str | None = None, **kwargs)[source]#
Bases:
sionna.phy.block.BlockAllows Cyclic Redundancy Check (CRC) verification and removes parity bits.
The CRC polynomials from Sec. 5.1 in [3GPPTS38212] are available: {CRC24A, CRC24B, CRC24C, CRC16, CRC11, CRC6}.
- Parameters:
crc_encoder (sionna.phy.fec.crc.CRCEncoder) – An instance of
CRCEncoderassociated with the CRCDecoder.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:
x_crc – […, k + crc_length], torch.float. Binary tensor containing the CRC-encoded bits (the last crc_length bits are parity bits).
- Outputs:
bits – […, k], torch.float. Binary tensor containing the information bit sequence without CRC parity bits.
crc_valid – […, 1], torch.bool. Boolean tensor containing the result of the CRC check per codeword.
Examples
import torch from sionna.phy.fec.crc import CRCEncoder, CRCDecoder encoder = CRCEncoder("CRC24A") decoder = CRCDecoder(encoder) bits = torch.randint(0, 2, (10, 100), dtype=torch.float32) encoded = encoder(bits) decoded, crc_valid = decoder(encoded) print(decoded.shape, crc_valid.all()) # torch.Size([10, 100]) tensor(True)
Attributes
- property encoder: sionna.phy.fec.crc.CRCEncoder#
CRC Encoder used for internal validation.
Methods