espnet2.asr_transducer.encoder.validation.validate_architecture
Less than 1 minute
espnet2.asr_transducer.encoder.validation.validate_architecture
espnet2.asr_transducer.encoder.validation.validate_architecture(input_conf: Dict[str, Any], body_conf: List[Dict[str, Any]], input_size: int) → Tuple[int, int]
Validate specified architecture is valid.
This function ensures that the input block and body blocks of the encoder architecture conform to the required configurations and constraints. It checks the input sizes and validates that the output of one block matches the input of the subsequent block.
- Parameters:
- input_conf – A dictionary containing the configuration for the encoder input block.
- body_conf – A list of dictionaries containing the configurations for the encoder body blocks.
- input_size – An integer representing the size of the encoder input.
- Returns: A tuple containing the output size of the encoder input block and the output size of the encoder body block.
- Return type: Tuple[int, int]
- Raises:
- ValueError – If there is an output/input size mismatch between blocks or
- if the configurations are invalid. –
Examples
>>> input_config = {"vgg_like": True, "subsampling_factor": 4}
>>> body_config = [{"block_type": "conv1d", "hidden_size": 128}]
>>> validate_architecture(input_config, body_config, 64)
(64, 128)
NOTE
The function relies on validate_input_block and validate_block_arguments to perform the necessary validations on the blocks.