espnet.nets.scorer_interface.BatchScorerInterface
Less than 1 minute
espnet.nets.scorer_interface.BatchScorerInterface
class espnet.nets.scorer_interface.BatchScorerInterface
Bases: ScorerInterface
Batch scorer interface.
batch_init_state(x: Tensor) → Any
Get an initial state for decoding (optional).
- Parameters:x (torch.Tensor) – The encoded feature tensor
Returns: initial state
batch_score(ys: Tensor, states: List[Any], xs: Tensor) → Tuple[Tensor, List[Any]]
Score new token batch (required).
- Parameters:
- ys (torch.Tensor) – torch.int64 prefix tokens (n_batch, ylen).
- states (List *[*Any ]) – Scorer states for prefix tokens.
- xs (torch.Tensor) – The encoder feature that generates ys (n_batch, xlen, n_feat).
- Returns: Tuple of : batchfied scores for next token with shape of (n_batch, n_vocab) and next state list for ys.
- Return type: tuple[torch.Tensor, List[Any]]