espnet.nets.pytorch_backend.transducer.utils.select_k_expansions
Less than 1 minute
espnet.nets.pytorch_backend.transducer.utils.select_k_expansions
espnet.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