count_block_errors#
- sionna.phy.utils.count_block_errors(b: torch.Tensor, b_hat: torch.Tensor) torch.Tensor[source]#
Counts the number of block errors between two binary tensors.
A block error happens if at least one element of
bandb_hatdiffer in one block. The BLER is evaluated over the last dimension of the input, i. e., all elements of the last dimension are considered to define a block.This is also sometimes referred to as word error rate or frame error rate.
- Parameters:
b (torch.Tensor) – A tensor of arbitrary shape filled with ones and zeros.
b_hat (torch.Tensor) – A tensor like
b.
- Outputs:
num_errors – torch.int64. Number of block errors.
Examples
import torch from sionna.phy.utils import count_block_errors b = torch.tensor([[0, 1], [1, 0]]) b_hat = torch.tensor([[0, 1], [1, 1]]) print(count_block_errors(b, b_hat).item()) # 1