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 = 'mean', dropout: float = 0.0)
Bases: AbsDecoder
Initialize the module.
forward(hs_pad: Tensor, hlens: Tensor, ys_in_pad: Tensor = None, ys_in_lens: Tensor = None) β Tuple[Tensor, Tensor]
Forward method.
- 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.
- Parameters:
- ys β Not used
- state β Not used
- 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.
