def __init__(self, decoding_cfg, decoder, joint, blank_id: int):
    super(AbstractRNNTDecoding, self).__init__()
    self.cfg = decoding_cfg
    self.blank_id = blank_id
    self.compute_hypothesis_token_set = self.cfg.get('compute_hypothesis_token_set', False)
    possible_strategies = ['greedy', 'greedy_batch', 'beam', 'tsd', 'alsd']
    if (self.cfg.strategy not in possible_strategies):
        raise ValueError(f'Decoding strategy must be one of {possible_strategies}')
    if (self.cfg.strategy == 'greedy'):
        self.decoding = greedy_decode.GreedyRNNTInfer(decoder_model=decoder, joint_model=joint, blank_index=self.blank_id, max_symbols_per_step=self.cfg.greedy.get('max_symbols', None))
    elif (self.cfg.strategy == 'greedy_batch'):
        self.decoding = greedy_decode.GreedyBatchedRNNTInfer(decoder_model=decoder, joint_model=joint, blank_index=self.blank_id, max_symbols_per_step=self.cfg.greedy.get('max_symbols', None))
    elif (self.cfg.strategy == 'beam'):
        self.decoding = beam_decode.BeamRNNTInfer(decoder_model=decoder, joint_model=joint, beam_size=self.cfg.beam.beam_size, return_best_hypothesis=decoding_cfg.beam.get('return_best_hypothesis', True), search_type='default', score_norm=self.cfg.beam.get('score_norm', True))
    elif (self.cfg.strategy == 'tsd'):
        self.decoding = beam_decode.BeamRNNTInfer(decoder_model=decoder, joint_model=joint, beam_size=self.cfg.beam.beam_size, return_best_hypothesis=decoding_cfg.beam.get('return_best_hypothesis', True), search_type='tsd', score_norm=self.cfg.beam.get('score_norm', True), tsd_max_sym_exp_per_step=self.cfg.beam.get('tsd_max_sym_exp', 50))
    elif (self.cfg.strategy == 'alsd'):
        self.decoding = beam_decode.BeamRNNTInfer(decoder_model=decoder, joint_model=joint, beam_size=self.cfg.beam.beam_size, return_best_hypothesis=decoding_cfg.beam.get('return_best_hypothesis', True), search_type='alsd', score_norm=self.cfg.beam.get('score_norm', True), alsd_max_target_len=self.cfg.beam.get('alsd_max_target_len', 2))
def __init__(self, decoding_cfg, decoder, joint, blank_id: int):
    super(AbstractRNNTDecoding, self).__init__()
    self.cfg = decoding_cfg
    self.blank_id = blank_id
    self.compute_hypothesis_token_set = self.cfg.get('compute_hypothesis_token_set', False)
    possible_strategies = ['greedy', 'greedy_batch', 'beam', 'tsd', 'alsd']
    if (self.cfg.strategy not in possible_strategies):
        raise ValueError(f'Decoding strategy must be one of {possible_strategies}')
    if (self.cfg.strategy == 'greedy'):
        self.decoding = greedy_decode.GreedyRNNTInfer(decoder_model=decoder, joint_model=joint, blank_index=self.blank_id, max_symbols_per_step=self.cfg.greedy.get('max_symbols', None))
    elif (self.cfg.strategy == 'greedy_batch'):
        self.decoding = greedy_decode.GreedyBatchedRNNTInfer(decoder_model=decoder, joint_model=joint, blank_index=self.blank_id, max_symbols_per_step=self.cfg.greedy.get('max_symbols', None))
    elif (self.cfg.strategy == 'beam'):
        self.decoding = beam_decode.BeamRNNTInfer(decoder_model=decoder, joint_model=joint, beam_size=self.cfg.beam.beam_size, return_best_hypothesis=decoding_cfg.beam.get('return_best_hypothesis', True), search_type='default', score_norm=self.cfg.beam.get('score_norm', True))
    elif (self.cfg.strategy == 'tsd'):
        self.decoding = beam_decode.BeamRNNTInfer(decoder_model=decoder, joint_model=joint, beam_size=self.cfg.beam.beam_size, return_best_hypothesis=decoding_cfg.beam.get('return_best_hypothesis', True), search_type='tsd', score_norm=self.cfg.beam.get('score_norm', True), tsd_max_sym_exp_per_step=self.cfg.beam.get('tsd_max_sym_exp', 50))
    elif (self.cfg.strategy == 'alsd'):
        self.decoding = beam_decode.BeamRNNTInfer(decoder_model=decoder, joint_model=joint, beam_size=self.cfg.beam.beam_size, return_best_hypothesis=decoding_cfg.beam.get('return_best_hypothesis', True), search_type='alsd', score_norm=self.cfg.beam.get('score_norm', True), alsd_max_target_len=self.cfg.beam.get('alsd_max_target_len', 2))