Mapper#

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

Bases: sionna.phy.block.Block

Maps binary tensors to points of a constellation.

This class defines a block that maps a tensor of binary values to a tensor of points from a provided constellation.

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

  • num_bits_per_symbol (int | None) – The 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) – If no constellation is provided, constellation_type and num_bits_per_symbol must be provided. Defaults to None.

  • return_indices (bool) – If enabled, symbol indices are additionally returned. 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:

bits – […, n], torch.float or torch.int. Tensor with binary entries.

Outputs:
  • x – […, n/Constellation.num_bits_per_symbol], torch.complex. Mapped constellation symbols.

  • ind – […, n/Constellation.num_bits_per_symbol], torch.int32. Symbol indices corresponding to the constellation symbols. Only returned if return_indices is set to True.

Notes

The last input dimension must be an integer multiple of the number of bits per constellation symbol.

To avoid synchronizing accelerator devices in this performance-critical path, input values are not checked at runtime. Every entry must be exactly zero or one; passing non-binary values has undefined behavior.

Examples

import torch
from sionna.phy.mapping import Mapper

mapper = Mapper("qam", 4)  # 16-QAM
bits = torch.randint(0, 2, (10, 100))
symbols = mapper(bits)
print(symbols.shape)
# torch.Size([10, 25])

Attributes

property constellation: sionna.phy.mapping.Constellation#

Constellation used by the Mapper