int_mod_2#
- sionna.phy.fec.utils.int_mod_2(x: torch.Tensor) torch.Tensor[source]#
Modulo 2 operation and implicit rounding for floating point inputs.
Performs more efficient modulo-2 operation for integer inputs using bitwise AND. For floating inputs, applies implicit rounding before the modulo operation.
- Parameters:
x (torch.Tensor) – Tensor to which the modulo 2 operation is applied.
- Outputs:
x_mod – Binary tensor containing the result of the modulo 2 operation, with the same shape as
x.
Examples
import torch from sionna.phy.fec.utils import int_mod_2 x = torch.tensor([0, 1, 2, 3, 4, 5]) result = int_mod_2(x) print(result) # tensor([0, 1, 0, 1, 0, 1])