espnet2.asr_transducer.encoder.building.build_input_block
Less than 1 minute
espnet2.asr_transducer.encoder.building.build_input_block
espnet2.asr_transducer.encoder.building.build_input_block(input_size: int, configuration: Dict[str, int | str]) → ConvInput
Build encoder input block.
This function constructs the input block for the encoder, which typically includes a convolutional layer for processing input features. The configuration dictates the specifics of the convolutional layer, such as size and subsampling factors.
- Parameters:
- input_size – The size of the input features.
- configuration – A dictionary containing the input block configuration, which must include the following keys:
- ‘conv_size’: Size of the convolutional layer.
- ‘subsampling_factor’: Factor by which to subsample the input.
- ‘vgg_like’: Boolean indicating whether to use VGG-like architecture.
- ‘output_size’: Size of the output features after the input block.
- Returns: An instance of the ConvInput block configured as specified.
- Return type:ConvInput
Examples
>>> config = {
... 'conv_size': 3,
... 'subsampling_factor': 2,
... 'vgg_like': True,
... 'output_size': 128
... }
>>> input_block = build_input_block(256, config)
>>> print(input_block)