compute_bler#

sionna.phy.utils.compute_bler(b: torch.Tensor, b_hat: torch.Tensor, precision: Literal['single', 'double'] = 'double') torch.Tensor[source]#

Computes the block error rate (BLER) between two binary tensors.

A block error happens if at least one element of b and b_hat differ 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.

  • precision (Literal['single', 'double']) – Precision used for internal calculations and outputs. Defaults to "double".

Outputs:

blertorch.float. BLER.

Examples

import torch
from sionna.phy.utils import compute_bler

b = torch.tensor([[0, 1], [1, 0]])
b_hat = torch.tensor([[0, 1], [1, 1]])
# The first block is correct, the second block is incorrect
print(compute_bler(b, b_hat).item())
# 0.5