class_docstr: Calculate CER and WER for transducer models.
  
  Args:
      decoder: Decoder module.
      token_list: List of tokens.
      sym_space: Space symbol.
      sym_blank: Blank symbol.
      report_cer: Whether to compute CER.
      report_wer: Whether to compute WER.
class_docstr_tok: ["Calculate","CER","and","WER","for","transducer","models",".","Args",":","decoder",":","Decoder","module",".","token_list",":","List","of","tokens",".","sym_space",":","Space","symbol",".","sym_blank",":","Blank","symbol",".","report_cer",":","Whether","to","compute","CER",".","report_wer",":","Whether","to","compute","WER","."]
docstr: Calculate sentence-level WER/CER score for Transducer model.
  
  Args:
      encoder_out: Encoder output sequences. (B, T, D_enc)
      target: Target label ID sequences. (B, L)
  
  Returns:
      : Sentence-level CER score.
      : Sentence-level WER score.
docstr_tok: ["Calculate","sentence-level","WER\/CER","score","for","Transducer","model",".","Args",":","encoder_out",":","Encoder","output","sequences",".","(","B",",","T",",","D_enc",")","target",":","Target","label","ID","sequences",".","(","B",",","L",")","Returns",":",":","Sentence-level","CER","score",".",":","Sentence-level","WER","score","."]
code: def __call__(self, encoder_out: torch.Tensor, target: torch.Tensor):
      """Calculate sentence-level WER/CER score for Transducer model.
  
      Args:
          encoder_out: Encoder output sequences. (B, T, D_enc)
          target: Target label ID sequences. (B, L)
  
      Returns:
          : Sentence-level CER score.
          : Sentence-level WER score.
  
      """
      cer, wer = None, None
  
      batchsize = int(encoder_out.size(0))
      batch_nbest = []
  
      encoder_out = encoder_out.to(
          next(self.decoder.parameters()).device
      )
  
      for b in range(batchsize):
          nbest_hyps = self.beam_search(encoder_out[b])
          batch_nbest.append(nbest_hyps)
  
      pred = [nbest_hyp[0].yseq[1:] for nbest_hyp in batch_nbest]
  
      char_pred, char_target = self.convert_to_char(pred, target)
  
      if self.report_cer:
          cer = self.calculate_cer(char_pred, char_target)
  
      if self.report_wer:
          wer = self.calculate_wer(char_pred, char_target)
  
      return cer, wer
  
file_path: espnet/espnet2/asr/transducer/error_calculator.py
imports: from typing import List, Tuple
  import torch
  from espnet2.asr.decoder.abs_decoder import AbsDecoder
  from espnet2.asr.transducer.beam_search_transducer import BeamSearchTransducer
label_desc: Use image node_id 2 for calling the ErrorCalculatorTransducer obj's underlying member method code with example usage: obj.__call__(encoder_out, target) and returns: cer,  wer