espnet2.asr_transducer.encoder.building.build_conv1d_block
Less than 1 minute
espnet2.asr_transducer.encoder.building.build_conv1d_block
espnet2.asr_transducer.encoder.building.build_conv1d_block(configuration: List[Dict[str, Any]], causal: bool) → Conv1d
Build Conv1d block.
This function constructs a Conv1d block based on the provided configuration and causal flag. The Conv1d block is used in various neural network architectures for processing sequential data.
- Parameters:
configuration –
A list of dictionaries where each dictionary contains the configuration parameters for the Conv1d block. Expected keys include:
- input_size: Size of the input features.
- output_size: Size of the output features.
- kernel_size: Size of the convolutional kernel.
- stride: Stride of the convolution (default is 1).
- dilation: Dilation factor (default is 1).
- groups: Number of groups for grouped convolution
(default is 1).
- bias: Whether to include a bias term (default is True).
- relu: Whether to apply ReLU activation (default is True).
- batch_norm: Whether to include batch normalization : (default is False).
causal – A boolean indicating whether the convolution should be causal. If True, the convolution will not include future time steps.
- Returns: A Conv1d block function that can be called to create the Conv1d layer.
Examples
>>> conv1d_block = build_conv1d_block(
... configuration=[
... {
... "input_size": 128,
... "output_size": 256,
... "kernel_size": 3,
... "stride": 1,
... "dilation": 1,
... "groups": 1,
... "bias": True,
... "relu": True,
... "batch_norm": False,
... }
... ],
... causal=True
... )
>>> conv_layer = conv1d_block()