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.BlockMaps 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
Constellationmust be provided.num_bits_per_symbol (int | None) – The number of bits per constellation symbol, e.g., 4 for QAM16. Only required for
constellation_typein [“qam”, “pam”].constellation (sionna.phy.mapping.Constellation | None) – If no constellation is provided,
constellation_typeandnum_bits_per_symbolmust 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,
precisionis used.device (str | None) – Device for tensor operations. If None,
deviceis 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_indicesis set to True.
Notes
The last input dimension must be an integer multiple of the number of bits per constellation symbol.
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