espnet2.legacy.nets.pytorch_backend.transducer.utils.select_k_expansions
Less than 1 minute
espnet2.legacy.nets.pytorch_backend.transducer.utils.select_k_expansions
espnet2.legacy.nets.pytorch_backend.transducer.utils.select_k_expansions(hyps: List[ExtendedHypothesis], topk_idxs: Tensor, topk_logps: Tensor, gamma: float) β List[ExtendedHypothesis]
Return K hypotheses candidates for expansion from a list of hypothesis.
K candidates are selected according to the extended hypotheses probabilities and a prune-by-value method. Where K is equal to beam_size + beta.
- Parameters:
- hyps β Hypotheses.
- topk_idxs β Indices of candidates hypothesis.
- topk_logps β Log-probabilities for hypotheses expansions.
- gamma β Allowed logp difference for prune-by-value method.
- Returns: Best K expansion hypotheses candidates.
- Return type: k_expansions
