espnet2.asr.transducer.beam_search_transducer_streaming.ExtendedHypothesis
espnet2.asr.transducer.beam_search_transducer_streaming.ExtendedHypothesis
class espnet2.asr.transducer.beam_search_transducer_streaming.ExtendedHypothesis(score: float, yseq: List[int], dec_state: Tuple[Tensor, Tensor | None] | List[Tensor | None] | Tensor, lm_state: Dict[str, Any] | List[Any] | None = None, dec_out: List[Tensor] | None = None, lm_scores: Tensor | None = None)
Bases: Hypothesis
Extended hypothesis definition for NSC beam search and mAES.
This class extends the base Hypothesis class to include additional attributes necessary for more sophisticated beam search algorithms such as N-step constrained (NSC) beam search and modified adaptive expansion search (mAES). It provides storage for the decoder output and language model scores, which are essential for evaluating and selecting hypotheses during the search process.
dec_out
A list of tensors representing the decoder outputs for the current hypothesis.
- Type: List[torch.Tensor]
lm_scores
A tensor holding the scores from the language model for the current hypothesis.
- Type: torch.Tensor
Examples
>>> hypothesis = ExtendedHypothesis(
... score=1.0,
... yseq=[2, 3, 4],
... dec_state=(torch.tensor([0.1]), None),
... dec_out=[torch.tensor([0.2]), torch.tensor([0.3])],
... lm_scores=torch.tensor([0.5, 0.6])
... )
>>> print(hypothesis.yseq)
[2, 3, 4]
>>> print(hypothesis.score)
1.0
>>> print(hypothesis.dec_out)
[tensor(0.2), tensor(0.3)]
dec_out
lm_scores