key_enforcer
KeyEnforcer
¶
Makes sure containers have the specified keys.
Source code in pytorch_adapt\containers\key_enforcer.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
|
__init__(**kwargs)
¶
Parameters:
Name | Type | Description | Default |
---|---|---|---|
**kwargs |
List[str]
|
A mapping from container name to a list of required keys for that container. |
{}
|
Source code in pytorch_adapt\containers\key_enforcer.py
12 13 14 15 16 17 18 |
|
check(containers)
¶
Compares the input containers' keys to self.requirements
.
Raises KeyError
if there is a mismatch.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
containers |
MultipleContainers
|
The containers to check. |
required |
Source code in pytorch_adapt\containers\key_enforcer.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
|