torchsig.utils.verify.verify_dict¶
- torchsig.utils.verify.verify_dict(d: dict, name: str, required_keys: list = [], required_types: list = [])[source]¶
Verifies that the value d is a dictionary and optionally checks for required keys and their types.
- Parameters:
d (dict) – The value to be checked.
name (str) – The name of the value to be used in error messages.
required_keys (list, optional) – A list of required keys in the dictionary. Defaults to an empty list.
required_types (list, optional) – A list of types for each required key. Defaults to an empty list.
- Raises:
ValueError – If d is not a dictionary, or if any required key is missing or has an incorrect type.
- Returns:
The verified dictionary d.
- Return type: