code: def test_error_rate_stats(device):
      from speechbrain.utils.metric_stats import ErrorRateStats
  
      wer_stats = ErrorRateStats()
      i2l = {1: "hello", 2: "world", 3: "the"}
  
      def mapper(batch):
          return [[i2l[int(x)] for x in seq] for seq in batch]
  
      wer_stats.append(
          ids=["utterance1", "utterance2"],
          predict=[[3, 2, 1], [2, 3]],
          target=torch.tensor([[3, 2, 0], [2, 1, 0]], device=device),
          target_len=torch.tensor([0.67, 0.67], device=device),
          ind2lab=mapper,
      )
      summary = wer_stats.summarize()
      assert summary["WER"] == 50.0
      assert summary["insertions"] == 1
      assert summary["substitutions"] == 1
      assert summary["deletions"] == 0
      assert wer_stats.scores[0]["ref_tokens"] == ["the", "world"]
      assert wer_stats.scores[0]["hyp_tokens"] == [
          "the",
          "world",
          "hello",
      ]
  
file_path: speechbrain/tests/unittests/test_metrics.py
imports: import torch
  import torch.nn
  import math
label_desc: Use image node_id 2 for calling a global function with example usage: test_error_rate_stats(device) and returns: unknown