DecoderStatisticsCallback#

class sionna.phy.fec.ldpc.DecoderStatisticsCallback(num_iter: int, device: str | None = None)[source]#

Bases: sionna.phy.object.Object

Callback for the LDPCBPDecoder to track decoder statistics.

Can be registered as c2v_callbacks in the LDPCBPDecoder and the LDPC5GDecoder.

Remark: the decoding statistics are based on CN convergence, i.e., successful decoding is assumed if all check nodes are fulfilled. This overestimates the success-rate as it includes cases where the decoder converges to the wrong codeword.

Parameters:
  • num_iter (int) – Maximum number of decoding iterations.

  • device (str | None) – Device for computation (e.g., ‘cpu’, ‘cuda:0’).

Inputs:
  • msg – [batch_size, num_vns, max_degree], torch.float. v2c messages.

  • itint. Current number of decoding iterations.

Outputs:

msgtorch.float. Same as msg.

Examples

from sionna.phy.fec.ldpc import LDPCBPDecoder
from sionna.phy.fec.ldpc.utils import DecoderStatisticsCallback

# Create callback
stats_cb = DecoderStatisticsCallback(num_iter=20)

# Create decoder with callback
decoder = LDPCBPDecoder(pcm, c2v_callbacks=[stats_cb])

# After decoding, access statistics
print(stats_cb.success_rate)
print(stats_cb.avg_number_iterations)

Attributes

property num_samples: torch.Tensor#

Total number of processed codewords

property num_decoded_cws: torch.Tensor#

Number of decoded codewords after each iteration

property success_rate: torch.Tensor#

Success rate after each iteration

property avg_number_iterations: torch.Tensor#

Average number of decoding iterations

Methods

reset_stats() None[source]#

Reset internal statistics