espnet2.asr_transducer.decoder.modules.mega.positional_bias.RelativePositionBias
Less than 1 minute
espnet2.asr_transducer.decoder.modules.mega.positional_bias.RelativePositionBias
class espnet2.asr_transducer.decoder.modules.mega.positional_bias.RelativePositionBias(max_positions: int)
Bases: Module
RelativePositionBias module definition.
- Parameters:max_positions – Maximum number of relative positions.
Construct a RelativePositionBias object.
forward(length: int) → Tensor
Compute relative position bias.
- Parameters:length – Sequence length.
- Returns: Relative position bias. (L, L)
- Return type: tile
reset_parameters(val: float = 0.0, std: float = 0.02) → None
Reset module parameters.
- Parameters:
- val – Initialization value.
- std – Standard deviation.