compute_ber#
- sionna.phy.utils.compute_ber(b: torch.Tensor, b_hat: torch.Tensor, precision: Literal['single', 'double'] = 'double') torch.Tensor[source]#
Computes the bit error rate (BER) between two binary tensors.
- Parameters:
b (torch.Tensor) – A tensor of arbitrary shape filled with ones and zeros.
b_hat (torch.Tensor) – A tensor like
b.precision (Literal['single', 'double']) – Precision used for internal calculations and outputs. Defaults to
"double".
- Outputs:
ber – torch.float. BER.
Examples
import torch from sionna.phy.utils import compute_ber b = torch.tensor([0, 1, 0, 1]) b_hat = torch.tensor([0, 1, 1, 0]) print(compute_ber(b, b_hat).item()) # 0.5