espnet2.asr_transducer.encoder.modules.convolution.DepthwiseConvolution
Less than 1 minute
espnet2.asr_transducer.encoder.modules.convolution.DepthwiseConvolution
class espnet2.asr_transducer.encoder.modules.convolution.DepthwiseConvolution(size: int, kernel_size: int, causal: bool = False)
Bases: Module
Depth-wise Convolution module definition.
- Parameters:
- size – Initial size to determine the number of channels.
- kernel_size – Size of the convolving kernel.
- causal – Whether to use causal convolution (set to True if streaming).
Construct a DepthwiseConvolution object.
forward(x: Tensor, mask: Tensor | None = None, cache: Tensor | None = None) → Tuple[Tensor, Tensor]
Compute convolution module.
- Parameters:
- x – DepthwiseConvolution input sequences. (B, T, D_hidden)
- mask – Source mask. (B, T_2)
- cache – DepthwiseConvolution input cache. (1, conv_kernel, D_hidden)
- Returns: DepthwiseConvolution output sequences. (B, ?, D_hidden)
- Return type: x