espnet2.asr.encoder.abs_look_ahead_encoder.AbsLookAheadEncoder
espnet2.asr.encoder.abs_look_ahead_encoder.AbsLookAheadEncoder
class espnet2.asr.encoder.abs_look_ahead_encoder.AbsLookAheadEncoder(*args: Any, **kwargs: Any)
Bases: AbsEncoder
An encoder whose output may read a chosen number of future frames.
One set of weights serves every look-ahead from 0 (online: an output frame depends on the current and past input frames only) to max_look_ahead (offline). set_look_ahead chooses it, for training as for inference. A convolutional encoder implements it by switching off future kernel taps; a self-attention encoder can implement it by masking the attention to keys after t + look_ahead.
Initialize internal Module state, shared by both nn.Module and ScriptModule.
abstract property look_ahead : int
Current look-ahead, in input frames.
abstract property max_look_ahead : int
Largest look-ahead, in input frames.
abstractmethod set_look_ahead(frames: int)
Make each output frame t read input frames up to t + frames.
- Raises:ValueError – frames is negative, larger than max_look_ahead, or not reachable by this encoder.
