class_docstr: CER and WER computation for Transducer model.
  
  Args:
      decoder: Decoder module.
      joint_network: Joint network module.
      token_list: Set of unique labels.
      sym_space: Space symbol.
      sym_blank: Blank symbol.
      report_cer: Whether to compute CER.
      report_wer: Whether to compute WER.
class_docstr_tok: ["CER","and","WER","computation","for","Transducer","model",".","Args",":","decoder",":","Decoder","module",".","joint_network",":","Joint","network","module",".","token_list",":","Set","of","unique","labels",".","sym_space",":","Space","symbol",".","sym_blank",":","Blank","symbol",".","report_cer",":","Whether","to","compute","CER",".","report_wer",":","Whether","to","compute","WER","."]
docstr: Calculate sentence-level CER/WER score for hypotheses sequences.
  
  Args:
      enc_out: Encoder output sequences. (B, T, D_enc)
      target: Target label ID sequences. (B, L)
  
  Returns:
      cer: Sentence-level CER score.
      wer: Sentence-level WER score.
docstr_tok: ["Calculate","sentence-level","CER\/WER","score","for","hypotheses","sequences",".","Args",":","enc_out",":","Encoder","output","sequences",".","(","B",",","T",",","D_enc",")","target",":","Target","label","ID","sequences",".","(","B",",","L",")","Returns",":","cer",":","Sentence-level","CER","score",".","wer",":","Sentence-level","WER","score","."]
code: def __call__(
      self, enc_out: torch.Tensor, target: torch.Tensor
  ) -> Tuple[float, float]:
      """Calculate sentence-level CER/WER score for hypotheses sequences.
  
      Args:
          enc_out: Encoder output sequences. (B, T, D_enc)
          target: Target label ID sequences. (B, L)
  
      Returns:
          cer: Sentence-level CER score.
          wer: Sentence-level WER score.
  
      """
      cer, wer = None, None
  
      batchsize = int(enc_out.size(0))
      batch_nbest = []
  
      enc_out = enc_out.to(next(self.decoder.parameters()).device)
  
      for b in range(batchsize):
          nbest_hyps = self.beam_search(enc_out[b])
          batch_nbest.append(nbest_hyps[-1])
  
      batch_nbest = [nbest_hyp.yseq[1:] for nbest_hyp in batch_nbest]
  
      hyps, refs = self.convert_to_char(batch_nbest, target.cpu())
  
      if self.report_cer:
          cer = self.calculate_cer(hyps, refs)
  
      if self.report_wer:
          wer = self.calculate_wer(hyps, refs)
  
      return cer, wer
  
file_path: espnet/espnet/nets/pytorch_backend/transducer/error_calculator.py
imports: from typing import List, Tuple, Union
  import torch
  from espnet.nets.beam_search_transducer import BeamSearchTransducer
  from espnet.nets.pytorch_backend.transducer.custom_decoder import CustomDecoder
  from espnet.nets.pytorch_backend.transducer.joint_network import JointNetwork
  from espnet.nets.pytorch_backend.transducer.rnn_decoder import RNNDecoder
label_desc: Use image node_id 2 for calling the ErrorCalculator obj's underlying member method code with example usage: obj.__call__(enc_out, target) and returns: cer,  wer