espnet2.legacy.nets.pytorch_backend.conformer.convolution.ConvolutionModule
Less than 1 minute
espnet2.legacy.nets.pytorch_backend.conformer.convolution.ConvolutionModule
class espnet2.legacy.nets.pytorch_backend.conformer.convolution.ConvolutionModule(channels, kernel_size, activation=ReLU(), bias=True)
Bases: Module
ConvolutionModule in Conformer model.
- Parameters:
- channels (int) – The number of channels of conv layers.
- kernel_size (int) – Kernerl size of conv layers.
Construct an ConvolutionModule object.
forward(x, mask_pad=None)
Compute convolution module.
- Parameters:
- x (torch.Tensor) – Input tensor (#batch, time, channels).
- mask_pad (torch.Tensor) – Non-padding mask (#batch, 1, time), True or 1 where a frame is real. When given, the padded frames are zeroed right before the depthwise convolution, so the last real frames of a padded utterance see the same neighbourhood they see when the utterance is encoded on its own (a padded frame is not zero at this point: the pointwise convolution and the GLU have already put their biases into it).
- Returns: Output tensor (#batch, time, channels).
- Return type: torch.Tensor
