Descrambler#

class sionna.phy.fec.scrambling.Descrambler(scrambler: sionna.phy.fec.scrambling.Scrambler | sionna.phy.fec.scrambling.TB5GScrambler, binary: bool = True, *, precision: str | None = None, device: str | None = None, **kwargs)[source]#

Bases: sionna.phy.block.Block

Descrambler for a given scrambler.

Parameters:
  • scrambler (sionna.phy.fec.scrambling.Scrambler | sionna.phy.fec.scrambling.TB5GScrambler) – Associated Scrambler or TB5GScrambler instance which should be descrambled.

  • binary (bool) – Indicates whether bit-sequence should be flipped (i.e., binary operations are performed) or the signs should be flipped (i.e., soft-value/LLR domain-based).

  • precision (str | None) – Precision used for internal calculations and outputs. If None, uses same precision as associated scrambler.

  • device (str | None) – Device for computation (e.g., ‘cpu’, ‘cuda:0’). If None, uses same device as associated scrambler.

Inputs:
  • x – torch.Tensor. Tensor of arbitrary shape.

  • seedint. An integer defining the state of the random number generator. If explicitly given, the global internal seed is replaced by this seed. Can be used to realize random scrambler/descrambler pairs (call with same random seed).

Outputs:

x_out – torch.Tensor. Tensor of same shape as x.

Examples

import torch
from sionna.phy.fec.scrambling import Scrambler, Descrambler

scrambler = Scrambler(seed=42, keep_state=True)
descrambler = Descrambler(scrambler, binary=False)

llrs = torch.randn(10, 100)
scrambled = scrambler(llrs, binary=False)
unscrambled = descrambler(scrambled)
assert torch.allclose(llrs, unscrambled)

Attributes

property scrambler: sionna.phy.fec.scrambling.Scrambler | sionna.phy.fec.scrambling.TB5GScrambler#

Associated scrambler instance.