ApplyOFDMChannel#

class sionna.phy.channel.ApplyOFDMChannel(precision: Literal['single', 'double'] | None = None, device: str | None = None, **kwargs)[source]#

Bases: sionna.phy.block.Block

Apply single-tap channel frequency responses to channel inputs

For each OFDM symbol \(s\) and subcarrier \(n\), the single-tap channel is applied as follows:

\[y_{s,n} = \widehat{h}_{s, n} x_{s,n} + w_{s,n}\]

where \(y_{s,n}\) is the channel output computed by this layer, \(\widehat{h}_{s, n}\) the frequency channel response (h_freq), \(x_{s,n}\) the channel input x, and \(w_{s,n}\) the additive noise.

For multiple-input multiple-output (MIMO) links, the channel output is computed for each antenna of each receiver and by summing over all the antennas of all transmitters.

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

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

Inputs:
  • x – [batch size, num_tx, num_tx_ant, num_ofdm_symbols, fft_size], torch.complex. Channel inputs.

  • h_freq – [batch size, num_rx, num_rx_ant, num_tx, num_tx_ant, num_ofdm_symbols, fft_size], torch.complex. Channel frequency responses.

  • noNone (default) | Tensor, torch.float. Tensor whose shape can be broadcast to the shape of the channel outputs: [batch size, num_rx, num_rx_ant, num_ofdm_symbols, fft_size]. The (optional) noise power no is per complex dimension. If no is a scalar, noise of the same variance will be added to the outputs. If no is a tensor, it must have a shape that can be broadcast to the shape of the channel outputs. This allows, e.g., adding noise of different variance to each example in a batch. If no has a lower rank than the channel outputs, then no will be broadcast to the shape of the channel outputs by adding dummy dimensions after the last axis.

Outputs:

y – [batch size, num_rx, num_rx_ant, num_ofdm_symbols, fft_size], torch.complex. Channel outputs.

Examples

import torch
from sionna.phy.channel import ApplyOFDMChannel

apply_ch = ApplyOFDMChannel()

# Create dummy inputs
batch_size, num_tx, num_tx_ant = 16, 2, 4
num_rx, num_rx_ant = 1, 8
num_ofdm_symbols, fft_size = 14, 64

x = torch.randn(batch_size, num_tx, num_tx_ant, num_ofdm_symbols, fft_size,
                dtype=torch.complex64)
h_freq = torch.randn(batch_size, num_rx, num_rx_ant, num_tx, num_tx_ant,
                     num_ofdm_symbols, fft_size, dtype=torch.complex64)

y = apply_ch(x, h_freq)
print(y.shape)
# torch.Size([16, 1, 8, 14, 64])