RowColumnInterleaver#

class sionna.phy.fec.interleaving.RowColumnInterleaver(row_depth: int, axis: int = -1, inverse: bool = False, precision: str | None = None, device: str | None = None, **kwargs)[source]#

Bases: sionna.phy.block.Block

Interleaves a sequence of inputs via row/column swapping.

Parameters:
  • row_depth (int) – The row depth, i.e., how many values per row can be stored.

  • axis (int) – The dimension that should be interleaved.

  • inverse (bool) – If True, the inverse permutation is performed.

  • precision (str | None) – Precision used for internal calculations and outputs. If None, precision is used.

  • device (str | None) – Device for computation (e.g., ‘cpu’, ‘cuda:0’). If None, device is used.

Inputs:

x – torch.Tensor. Tensor of arbitrary shape and arbitrary dtype.

Outputs:

x_int – torch.Tensor. Tensor of same shape and dtype as x.

Notes

If the sequence length is not a multiple of row_depth, additional filler bits are used for the last row that will be removed internally. However, for the last positions the interleaving distance may be slightly degraded.

Examples

import torch
from sionna.phy.fec.interleaving import RowColumnInterleaver

interleaver = RowColumnInterleaver(row_depth=4)
x = torch.arange(12).reshape(1, 12).float()
y = interleaver(x)
print(y)
# tensor([[ 0.,  4.,  8.,  1.,  5.,  9.,  2.,  6., 10.,  3.,  7., 11.]])

Attributes

property axis: int#

Axis to be permuted.

property row_depth: int#

Row depth of the row-column interleaver.

property perm_seq: torch.Tensor | None#

Permutation sequence.

property perm_seq_inv: torch.Tensor | None#

Inverse permutation sequence.

property keep_state: bool#

Row-column interleaver always uses the same internal state.

Methods

build(input_shape: tuple) None[source]#

Build block and check dimensions.

Parameters:

input_shape (tuple) – Shape of input tensor.