ApplyTimeChannel#
- class sionna.phy.channel.ApplyTimeChannel(num_time_samples: int, l_tot: int, precision: str | None = None, device: str | None = None, **kwargs)[source]#
Bases:
sionna.phy.block.BlockApply time domain channel responses
h_timeto channel inputsx, by filtering the channel inputs with time-variant channel responses.For each batch example,
num_time_samples+l_tot- 1 time steps of a channel realization are required to filter the channel inputs.The channel output consists of
num_time_samples+l_tot- 1 time samples, as it is the result of filtering the channel input of lengthnum_time_sampleswith the time-variant channel filter of lengthl_tot. In the case of a single-input single-output link and given a sequence of channel inputs \(x_0,\cdots,x_{N_B}\), where \(N_B\) isnum_time_samples, this layer outputs\[y_b = \sum_{\ell = 0}^{L_{\text{tot}}} x_{b-\ell} \bar{h}_{b,\ell} + w_b\]where \(L_{\text{tot}}\) corresponds
l_tot, \(w_b\) to the additive noise, and \(\bar{h}_{b,\ell}\) to the \(\ell^{th}\) tap of the \(b^{th}\) channel sample. This layer outputs \(y_b\) for \(b\) ranging from 0 to \(N_B + L_{\text{tot}} - 1\), and \(x_{b}\) is set to 0 for \(b \geq N_B\).For multiple-input multiple-output (MIMO) links, the channel output is computed for each antenna of each receiver and by summing over all the antennas of all transmitters.
- Parameters:
num_time_samples (int) – Number of time samples forming the channel input (\(N_B\))
l_tot (int) – Length of the channel filter (\(L_{\text{tot}} = L_{\text{max}} - L_{\text{min}} + 1\))
precision (str | None) – None (default) | “single” | “double”. Precision used for internal calculations and outputs. If set to None,
precisionis used.device (str | None) – Device for computation. If None,
deviceis used.
- Inputs:
x – [batch size, num_tx, num_tx_ant, num_time_samples], torch.complex. Channel inputs.
h_time – [batch size, num_rx, num_rx_ant, num_tx, num_tx_ant, num_time_samples + l_tot - 1, l_tot], torch.complex. Channel responses. For each batch example,
num_time_samples+l_tot- 1 time steps of a channel realization are required to filter the channel inputs.no – None (default) | torch.Tensor, torch.float. Scalar or tensor whose shape can be broadcast to the shape of the channel outputs: [batch size, num_rx, num_rx_ant, num_time_samples + l_tot - 1]. The (optional) noise power
nois per complex dimension. Ifnois a scalar, noise of the same variance will be added to the outputs. Ifnois a tensor, it must have a shape that can be broadcast to the shape of the channel outputs. This allows, e.g., adding noise of different variance to each example in a batch. Ifnohas a lower rank than the channel outputs, thennowill be broadcast to the shape of the channel outputs by adding dummy dimensions after the last axis.
- Outputs:
y – [batch size, num_rx, num_rx_ant, num_time_samples + l_tot - 1], torch.complex. Channel outputs. The channel output consists of
num_time_samples+l_tot- 1 time samples, as it is the result of filtering the channel input of lengthnum_time_sampleswith the time-variant channel filter of lengthl_tot.
Examples
import torch from sionna.phy.channel import ApplyTimeChannel num_time_samples = 100 l_tot = 27 batch_size = 32 num_tx, num_tx_ant = 1, 4 num_rx, num_rx_ant = 1, 2 apply_channel = ApplyTimeChannel(num_time_samples=num_time_samples, l_tot=l_tot) x = torch.randn(batch_size, num_tx, num_tx_ant, num_time_samples, dtype=torch.complex64) h_time = torch.randn(batch_size, num_rx, num_rx_ant, num_tx, num_tx_ant, num_time_samples + l_tot - 1, l_tot, dtype=torch.complex64) y = apply_channel(x, h_time) print(y.shape) # torch.Size([32, 1, 2, 126])
Attributes