espnet2.asr.decoder.linear_decoder.LinearDecoder
Less than 1 minute
espnet2.asr.decoder.linear_decoder.LinearDecoder
class espnet2.asr.decoder.linear_decoder.LinearDecoder(vocab_size: int, encoder_output_size: int, pooling: str = 'CLS', dropout: float = 0.0)
Bases: AbsDecoder
Initialize the module.
forward(hs_pad: Tensor, hlens: Tensor, ys_in_pad: Tensor | None = None, ys_in_lens: Tensor | None = None) → Tuple[Tensor, Tensor]
- Parameters:
- hs_pad – (B, Tmax, D)
- hlens – (B,)
- Returns: (B, n_classes)
- Return type: output
output_size() → int
Get the output size.
score(ys, state, x)
Classify x. :param ys: Not used :param state: Not used :param x: (T, D). this should be a single sample without
any padding ie batch size=1.
- Returns: log probabilities over (n_classes,) state: None
- Return type: logp
Assumes that x is a single unpadded sequence.