espnet2.layers.create_adapter_utils.check_target_module_exists
Less than 1 minute
espnet2.layers.create_adapter_utils.check_target_module_exists
espnet2.layers.create_adapter_utils.check_target_module_exists(key: str, target_modules: List[str])
Check if the target_modules matches the given key.
This function checks whether any of the target module names in the target_modules list match the specified key. It returns True if there is a match; otherwise, it returns False.
- Parameters:
- key (str) – The key to check against the target modules.
- target_modules (List *[*str ]) – A list of target module names to match.
- Returns: True if the key matches any of the target modules; False otherwise.
- Return type: bool
Examples
>>> check_target_module_exists("conv1", ["conv1", "conv2"])
True
>>> check_target_module_exists("fc", ["conv1", "conv2"])
False