class_docstr: Beam search implementation for Transducer.
docstr: Greedy Search for Multi-Blank Transducer (Multi-Blank Greedy, MBG).
  
  In this implementation, we assume:
  1. the index of standard blank is the last entry of self.multi_blank_indices
     rather than self.blank_id (to avoid too much change on original transducer)
  2. other entries in self.multi_blank_indices are big blanks that account for
     multiple frames.
  
  Based on https://arxiv.org/abs/2211.03541
  
  Args:
      enc_out: Encoder output sequence. (T, D_enc)
  
  Returns:
      hyp: 1-best hypothesis.
docstr_tok: ["Greedy","Search","for","Multi-Blank","Transducer","(","Multi-Blank","Greedy",",","MBG",")",".","In","this","implementation",",","we","assume",":","1.","the","index","of","standard","blank","is","the","last","entry","of","self.multi_blank_indices","rather","than","self.blank_id","(","to","avoid","too","much","change","on","original","transducer",")","2.","other","entries","in","self.multi_blank_indices","are","big","blanks","that","account","for","multiple","frames",".","Based","on","https",":","\/\/arxiv.org\/abs\/2211.03541","Args",":","enc_out",":","Encoder","output","sequence",".","(","T",",","D_enc",")","Returns",":","hyp",":","1-best","hypothesis","."]
code: def multi_blank_greedy_search(
      self, enc_out: torch.Tensor
  ) -> List[Hypothesis]:
      """Greedy Search for Multi-Blank Transducer (Multi-Blank Greedy, MBG).
  
      In this implementation, we assume:
      1. the index of standard blank is the last entry of self.multi_blank_indices
         rather than self.blank_id (to avoid too much change on original transducer)
      2. other entries in self.multi_blank_indices are big blanks that account for
         multiple frames.
  
      Based on https://arxiv.org/abs/2211.03541
  
      Args:
          enc_out: Encoder output sequence. (T, D_enc)
  
      Returns:
          hyp: 1-best hypothesis.
  
      """
  
      big_blank_duration = 1
      blank_start = self.multi_blank_indices[0]
      blank_end = self.multi_blank_indices[-1]
  
      dec_state = self.decoder.init_state(1)
      hyp = Hypothesis(score=0.0, yseq=[blank_end], dec_state=dec_state)
      cache = {}
  
      for enc_out_t in enc_out:
          # case 1: skip frames until big_blank_duration == 1
          if big_blank_duration > 1:
              big_blank_duration -= 1
              continue
  
          symbols_added = 0
          while symbols_added <= 3:
              dec_out, state, _ = self.decoder.score(hyp, cache)
              logp = torch.log_softmax(
                  self.joint_network(enc_out_t, dec_out), dim=-1
              )
              top_logp, k = torch.max(logp, dim=-1)
  
              # case 2: predict a blank token
              if blank_start <= k <= blank_end:
                  big_blank_duration = self.multi_blank_durations[
                      k - blank_start
                  ]
                  hyp.score += top_logp
                  break
  
              # case 3: predict a non-blank token
              else:
                  symbols_added += 1
                  hyp.yseq.append(int(k))
                  hyp.score += float(top_logp)
                  hyp.dec_state = state
  
      return [hyp]
  
imports: import logging
  from dataclasses import dataclass
  from typing import Any, Dict, List, Optional, Tuple, Union
  import numpy
  import torch
  from espnet2.asr.decoder.abs_decoder import AbsDecoder
  from espnet2.asr_transducer.joint_network import JointNetwork
  from espnet2.lm.transformer_lm import TransformerLM
  from espnet.nets.pytorch_backend.transducer.utils import is_prefix, recombine_hyps, select_k_expansions, subtract
label_desc: Use image node_id 11 for calling the BeamSearchTransducer obj's underlying member method code with example usage: obj.multi_blank_greedy_search(enc_out) and returns: list