OFDMModulator#

class sionna.phy.ofdm.OFDMModulator(cyclic_prefix_length: int | numpy.ndarray | torch.Tensor = 0, precision: Literal['single', 'double'] | None = None, device: str | None = None, **kwargs)[source]#

Bases: sionna.phy.block.Block

Computes the time-domain representation of an OFDM resource grid with (optional) cyclic prefix.

Parameters:
  • cyclic_prefix_length (int | numpy.ndarray | torch.Tensor) – Integer or vector of integers indicating the length of the cyclic prefix that is prepended to each OFDM symbol. None of its elements can be larger than the FFT size. Defaults to 0.

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

inputs – […, num_ofdm_symbols, fft_size], torch.complex. Resource grid in the frequency domain.

Outputs:

x_time – […, num_ofdm_symbols*(fft_size+cyclic_prefix_length)] or […, num_ofdm_symbols*fft_size+sum(cyclic_prefix_length)], torch.complex. Time-domain OFDM signal.

Examples

import torch
from sionna.phy.ofdm import OFDMModulator

modulator = OFDMModulator(cyclic_prefix_length=16)
# Resource grid: [batch, num_ofdm_symbols, fft_size]
x_freq = torch.randn(64, 14, 72, dtype=torch.complex64)
x_time = modulator(x_freq)
print(x_time.shape)
# torch.Size([64, 1232])  # 14 * (72 + 16) = 1232

Attributes

property cyclic_prefix_length: torch.Tensor#

Get/set the cyclic prefix length (scalar or per-symbol)

Methods

build(input_shape: tuple) None[source]#

Build the modulator based on input shape.

Parameters:

input_shape (tuple) – Shape of the input tensor […, num_ofdm_symbols, fft_size]