PAMSource#

class sionna.phy.mapping.PAMSource(num_bits_per_symbol: int | None = None, return_indices: bool = False, return_bits: bool = False, precision: Literal['single', 'double'] | None = None, device: str | None = None, **kwargs: Any)[source]#

Bases: sionna.phy.mapping.SymbolSource

Generates a tensor of random PAM symbols.

Optionally, the symbol indices and/or binary representations of the constellation symbols can be returned.

Parameters:
  • num_bits_per_symbol (int | None) – Number of bits per constellation symbol, e.g., 2 for 4-PAM.

  • return_indices (bool) – If enabled, the function also returns the symbol indices. Defaults to False.

  • return_bits (bool) – If enabled, the function also returns the binary symbol representations (i.e., bit labels). Defaults to False.

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

  • kwargs (Any)

Inputs:

shape – 1D tensor/array/list, int. Desired shape of the output tensor.

Outputs:
  • symbolsshape, torch.complex. Tensor filled with random PAM symbols.

  • symbol_indicesshape, torch.int32. Tensor filled with the symbol indices. Only returned if return_indices is True.

  • bits – [shape, num_bits_per_symbol], torch.float. Tensor filled with the binary symbol representations (i.e., bit labels). Only returned if return_bits is True.

Examples

import torch
from sionna.phy.mapping import PAMSource

source = PAMSource(2)  # 4-PAM
symbols = source([10, 100])
print(symbols.shape)
# torch.Size([10, 100])