class_docstr: Calculate CER and WER for E2E_ASR and CTC models during training.
  
  :param y_hats: numpy array with predicted text
  :param y_pads: numpy array with true (target) text
  :param char_list:
  :param sym_space:
  :param sym_blank:
  :return:
docstr: Calculate sentence-level WER/CER score.
  
  :param torch.Tensor ys_hat: prediction (batch, seqlen)
  :param torch.Tensor ys_pad: reference (batch, seqlen)
  :param bool is_ctc: calculate CER score for CTC
  :return: sentence-level WER score
  :rtype float
  :return: sentence-level CER score
  :rtype float
docstr_tok: ["Calculate","sentence-level","WER\/CER","score",".",":","param","torch.Tensor","ys_hat",":","prediction","(","batch",",","seqlen",")",":","param","torch.Tensor","ys_pad",":","reference","(","batch",",","seqlen",")",":","param","bool","is_ctc",":","calculate","CER","score","for","CTC",":","return",":","sentence-level","WER","score",":","rtype","float",":","return",":","sentence-level","CER","score",":","rtype","float"]
code: def __call__(self, ys_hat, ys_pad, is_ctc=False):
      """Calculate sentence-level WER/CER score.
  
      :param torch.Tensor ys_hat: prediction (batch, seqlen)
      :param torch.Tensor ys_pad: reference (batch, seqlen)
      :param bool is_ctc: calculate CER score for CTC
      :return: sentence-level WER score
      :rtype float
      :return: sentence-level CER score
      :rtype float
      """
      cer, wer = None, None
      if is_ctc:
          return self.calculate_cer_ctc(ys_hat, ys_pad)
      elif not self.report_cer and not self.report_wer:
          return cer, wer
  
      seqs_hat, seqs_true = self.convert_to_char(ys_hat, ys_pad)
      if self.report_cer:
          cer = self.calculate_cer(seqs_hat, seqs_true)
  
      if self.report_wer:
          wer = self.calculate_wer(seqs_hat, seqs_true)
      return cer, wer
  
file_path: espnet/espnet/nets/e2e_asr_common.py
imports: import json
  import logging
  import sys
  from itertools import groupby
  import numpy
label_desc: Use image node_id 2 for calling the ErrorCalculator obj's underlying member method code with example usage: obj.__call__(ys_hat, ys_pad, is_ctc) and returns: cer,  wer, self, cer,  wer