OFDMDetectorWithPrior#

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

Bases: sionna.phy.ofdm.detection.OFDMDetector

Block that wraps a MIMO detector that assumes prior knowledge of the bits or constellation points is available, for use with the OFDM waveform.

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

This class pre-processes the received resource grid y, channel estimate h_hat, and the prior information prior, 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{prior}, \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.

  • prior ([…,num_streams_per_rx,num_bits_per_symbol] or […,num_streams_per_rx,num_points], torch.float) – Prior for the transmitted signals. If output equals “bit”, then LLRs for the transmitted bits are expected. If output equals “symbol”, then logits for the transmitted constellation points are expected.

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

It must generate one of the 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:
  • detector (Callable) – Callable object (e.g., a function) that implements a MIMO detection algorithm with prior for arbitrary batch dimensions. Either the existing detector MaximumLikelihoodDetector can be used, or a custom detector callable provided that has the same input/output specification.

  • output (str) – Type of output, either “bit” or “symbol”

  • resource_grid (sionna.phy.ofdm.resource_grid.ResourceGrid) – ResourceGrid to be used

  • stream_management (sionna.phy.mimo.stream_management.StreamManagement) – StreamManagement to be used

  • constellation_type (str | None) – Type of constellation, None (default), “qam”, “pam”, or “custom”. For “custom”, an instance of Constellation must be provided.

  • num_bits_per_symbol (int | None) – Number of bits per constellation symbol, e.g., 4 for QAM16. Only required for constellation_type in [“qam”, “pam”].

  • constellation (sionna.phy.mapping.Constellation | None) – Instance of Constellation or None. If None, constellation_type and num_bits_per_symbol must be provided.

  • precision (Literal['single', 'double'] | None) – Precision used for internal calculations and outputs. If set to None, precision is used.

  • device (str | None) – Device for tensor operations. If None, device is used.

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.

  • prior – [batch_size, num_tx, num_streams, num_data_symbols x num_bits_per_symbol] or [batch_size, num_tx, num_streams, num_data_symbols, num_points], torch.float. Prior of the transmitted signals. If output equals “bit”, LLRs of the transmitted bits are expected. If output equals “symbol”, logits of the transmitted constellation points are expected.

  • 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.

Methods

build(y_shape, h_hat_shape, prior_shape, err_var_shape, no_shape)[source]#

Pre-allocate buffers based on input shapes.

Called automatically by Block.__call__ in eager mode before tracing. This ensures tensor allocations happen outside the compiled graph.

allocate_for_batch_size(batch_size: int) None[source]#

Pre-allocate buffers for CUDAGraph compatibility.

Parameters:

batch_size (int) – Batch size to allocate for