SymbolSource#
- class sionna.phy.mapping.SymbolSource(constellation_type: str | None = None, num_bits_per_symbol: int | None = None, constellation: sionna.phy.mapping.Constellation | 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.block.BlockGenerates a tensor of random constellation symbols.
Optionally, the symbol indices and/or binary representations of the constellation symbols can be returned.
- 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) – 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, 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,
precisionis used.device (str | None) – Device for tensor operations. If None,
deviceis used.kwargs (Any)
- Inputs:
shape – 1D tensor/array/list, int. Desired shape of the output tensor.
- Outputs:
symbols –
shape, torch.complex. Tensor filled with random symbols of the chosenconstellation_type.symbol_indices –
shape, torch.int32. Tensor filled with the symbol indices. Only returned ifreturn_indicesis True.bits – [
shape,num_bits_per_symbol], torch.float. Tensor filled with the binary symbol representations (i.e., bit labels). Only returned ifreturn_bitsis True.
Examples
import torch from sionna.phy.mapping import SymbolSource source = SymbolSource("qam", 4) symbols = source([10, 100]) print(symbols.shape) # torch.Size([10, 100])