QAMSource#
- class sionna.phy.mapping.QAMSource(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.SymbolSourceGenerates a tensor of random QAM 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., 4 for QAM16.
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 QAM symbols.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 QAMSource source = QAMSource(4) # 16-QAM symbols = source([10, 100]) print(symbols.shape) # torch.Size([10, 100])