espnet2.asr_transducer.encoder.modules.convolution.ConformerConvolution
Less than 1 minute
espnet2.asr_transducer.encoder.modules.convolution.ConformerConvolution
class espnet2.asr_transducer.encoder.modules.convolution.ConformerConvolution(channels: int, kernel_size: int, activation: Module = ReLU(), norm_args: Dict = {}, causal: bool = False)
Bases: Module
ConformerConvolution module definition.
- Parameters:
- channels – The number of channels.
- kernel_size – Size of the convolving kernel.
- activation – Activation function.
- norm_args – Normalization module arguments.
- causal – Whether to use causal convolution (set to True if streaming).
Construct an ConformerConvolution object.
forward(x: Tensor, mask: Tensor | None = None, cache: Tensor | None = None) → Tuple[Tensor, Tensor]
Compute convolution module.
- Parameters:
- x – ConformerConvolution input sequences. (B, T, D_hidden)
- mask – Source mask. (B, T_2)
- cache – ConformerConvolution input cache. (1, D_hidden, conv_kernel)
- Returns: ConformerConvolution output sequences. (B, ?, D_hidden) cache: ConformerConvolution output cache. (1, D_hidden, conv_kernel)
- Return type: x