count_errors#

sionna.phy.utils.count_errors(b: torch.Tensor, b_hat: torch.Tensor) torch.Tensor[source]#

Counts the number of bit errors 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.

Outputs:

num_errorstorch.int64. Number of bit errors.

Examples

import torch
from sionna.phy.utils import count_errors

b = torch.tensor([0, 1, 0, 1])
b_hat = torch.tensor([0, 1, 1, 0])
print(count_errors(b, b_hat).item())
# 2