class_docstr: Batch processing of CTCPrefixScore
  
  which is based on Algorithm 2 in WATANABE et al.
  "HYBRID CTC/ATTENTION ARCHITECTURE FOR END-TO-END SPEECH RECOGNITION,"
  but extended to efficiently compute the label probablities for multiple
  hypotheses simultaneously
  See also Seki et al. "Vectorized Beam Search for CTC-Attention-Based
  Speech Recognition," In INTERSPEECH (pp. 3825-3829), 2019.
class_docstr_tok: ["Batch","processing","of","CTCPrefixScore","which","is","based","on","Algorithm","2","in","WATANABE","et","al",".","``","HYBRID","CTC\/ATTENTION","ARCHITECTURE","FOR","END-TO-END","SPEECH","RECOGNITION",",","''","but","extended","to","efficiently","compute","the","label","probablities","for","multiple","hypotheses","simultaneously","See","also","Seki","et","al",".","``","Vectorized","Beam","Search","for","CTC-Attention-Based","Speech","Recognition",",","''","In","INTERSPEECH","(","pp",".","3825-3829",")",",","2019","."]
docstr: Compute CTC prefix state.
  
  
  :param state    : CTC state
  :return ctc_state
docstr_tok: ["Compute","CTC","prefix","state",".",":","param","state",":","CTC","state",":","return","ctc_state"]
code: def extend_state(self, state):
      """Compute CTC prefix state.
  
  
      :param state    : CTC state
      :return ctc_state
      """
  
      if state is None:
          # nothing to do
          return state
      else:
          r_prev, s_prev, f_min_prev, f_max_prev = state
  
          r_prev_new = torch.full(
              (self.input_length, 2),
              self.logzero,
              dtype=self.dtype,
              device=self.device,
          )
          start = max(r_prev.shape[0], 1)
          r_prev_new[0:start] = r_prev
          for t in range(start, self.input_length):
              r_prev_new[t, 1] = (
                  r_prev_new[t - 1, 1] + self.x[0, t, :, self.blank]
              )
  
          return (r_prev_new, s_prev, f_min_prev, f_max_prev)
  
file_path: espnet/espnet/nets/ctc_prefix_score.py
imports: import numpy
  import torch
label_desc: Use image node_id 5 for calling the CTCPrefixScoreTH obj's underlying member method code with example usage: obj.extend_state(state) and returns: state, r_prev_new,  s_prev,  f_min_prev,  f_max_prev