OFDMDetector#

class sionna.phy.ofdm.OFDMDetector(detector: Callable, output: str, resource_grid: sionna.phy.ofdm.resource_grid.ResourceGrid, stream_management: sionna.phy.mimo.stream_management.StreamManagement, precision: Literal['single', 'double'] | None = None, device: str | None = None, **kwargs)[source]#

Bases: sionna.phy.block.Block

Block that wraps a MIMO detector for use with the OFDM waveform.

The parameter detector is a callable (e.g., a function) that implements a MIMO detection algorithm for arbitrary batch dimensions.

This class pre-processes the received resource grid y and channel estimate h_hat, and computes for each receiver the noise-plus-interference covariance matrix according to the OFDM and stream configuration provided by the resource_grid and stream_management, which also accounts for the channel estimation error variance err_var. These quantities serve as input to the detection algorithm that is implemented by detector. Both detection of symbols or bits with either soft- or hard-decisions are supported.

Notes

The callable detector must take as input a tuple \((\mathbf{y}, \mathbf{h}, \mathbf{s})\) such that:

  • y ([…,num_rx_ant], torch.complex) – 1+D tensor containing the received signals.

  • h ([…,num_rx_ant,num_streams_per_rx], torch.complex) – 2+D tensor containing the channel matrices.

  • s ([…,num_rx_ant,num_rx_ant], torch.complex) – 2+D tensor containing the noise-plus-interference covariance matrices.

It must generate one of following outputs depending on the value of output:

  • b_hat ([…, num_streams_per_rx, num_bits_per_symbol], torch.float) – LLRs or hard-decisions for every bit of every stream, if output equals “bit”.

  • x_hat ([…, num_streams_per_rx, num_points], torch.float) or ([…, num_streams_per_rx], torch.int) – Logits or hard-decisions for constellation symbols for every stream, if output equals “symbol”. Hard-decisions correspond to the symbol indices.

Parameters:
Inputs:
  • y – [batch_size, num_rx, num_rx_ant, num_ofdm_symbols, fft_size], torch.complex. Received OFDM resource grid after cyclic prefix removal and FFT.

  • h_hat – [batch_size, num_rx, num_rx_ant, num_tx, num_streams_per_tx, num_ofdm_symbols, num_effective_subcarriers], torch.complex. Channel estimates for all streams from all transmitters.

  • err_var – [Broadcastable to shape of h_hat], torch.float. Variance of the channel estimation error.

  • no – [batch_size, num_rx, num_rx_ant] (or only the first n dims), torch.float. Variance of the AWGN.

Outputs:

z

One of:

[batch_size, num_tx, num_streams, num_data_symbols*num_bits_per_symbol], torch.float. LLRs or hard-decisions for every bit of every stream, if output equals “bit”.

[batch_size, num_tx, num_streams, num_data_symbols, num_points], torch.float or [batch_size, num_tx, num_streams, num_data_symbols], torch.int32. Logits or hard-decisions for constellation symbols for every stream, if output equals “symbol”. Hard-decisions correspond to the symbol indices.

Examples

import numpy as np
import torch
from sionna.phy.ofdm import ResourceGrid, LinearDetector
from sionna.phy.mimo import StreamManagement

rg = ResourceGrid(num_ofdm_symbols=14,
                  fft_size=64,
                  subcarrier_spacing=30e3,
                  num_tx=2,
                  num_streams_per_tx=2,
                  pilot_pattern="kronecker",
                  pilot_ofdm_symbol_indices=[2, 11])
sm = StreamManagement(np.ones([1, 2]), 2)
detector = LinearDetector("lmmse", "bit", "app", rg, sm,
                          constellation_type="qam",
                          num_bits_per_symbol=4)

batch_size = 16
y = torch.randn(batch_size, 1, 4, 14, 64, dtype=torch.complex64)
h_hat = torch.randn(batch_size, 1, 4, 2, 2, 14, 60,
                    dtype=torch.complex64)
err_var = torch.ones(1) * 0.01
no = torch.ones(1) * 0.1

llr = detector(y, h_hat, err_var, no)
print(llr.shape)
# torch.Size([16, 2, 2, 3360])