espnet2.asr_transducer.encoder.validation.validate_input_block
espnet2.asr_transducer.encoder.validation.validate_input_block
espnet2.asr_transducer.encoder.validation.validate_input_block(configuration: Dict[str, Any], body_first_conf: Dict[str, Any], input_size: int) → int
Validate the input block configuration for the encoder architecture.
This function checks the validity of the input block configuration against the first body block configuration. It ensures that the parameters are correctly set and compatible with the specified block types and subsampling factors.
espnet2.asr_transducer.encoder.validation.configuration
Encoder input block configuration.
- Type: Dict[str, Any]
espnet2.asr_transducer.encoder.validation.body_first_conf
Encoder first body block configuration.
- Type: Dict[str, Any]
espnet2.asr_transducer.encoder.validation.input_size
Encoder input block input size.
Type: int
Parameters:
- configuration – A dictionary containing the configuration for the encoder input block.
- body_first_conf – A dictionary containing the configuration for the first body block of the encoder.
- input_size – An integer representing the input size for the encoder input block.
Returns: The output size of the encoder input block.
Return type: int
Raises:ValueError – If the subsampling factor is invalid for the specified block type or if the configuration parameters are missing or incompatible.
Examples
>>> input_config = {"vgg_like": True, "subsampling_factor": 4, "conv_size": 64}
>>> body_config = {"block_type": "conformer", "hidden_size": 128}
>>> output_size = validate_input_block(input_config, body_config, 256)
>>> print(output_size)
128
NOTE
- The function supports both VGG-like and standard Conv2D input modules.
- Valid subsampling factors differ based on the input module type.