npu.utils.dict_utils
Classes
- class npu.utils.dict_utils.DictUtils
- Author:
Alberto M. Esmoris Pena
Class with util static methods to work with dictionaries.
- static delete_by_val(dict, val)
- Delete all the entries on the dictionary with exactly the
given value.
- Parameters:
dict – The dictionary to be updated.
val – The value of the entries to be removed.
- Returns:
A version of the input dictionary after deleting the requested entries.
- static add_defaults(dict, defaults)
For any value that is not explicitly available in the input dictionary dict, set it from the defaults dictionary (if available).
NOTE updates are done in place.
- Parameters:
dict – The input dictionary whose defaults must be set.
defaults – The dictionary with the default values.
- Returns:
The updated input dictionary dict.
- static merge(x, y)
Merge two dictionaries into a single one.
- Parameters:
x (dict) – The first dictionary to merge.
y (dict) – The second dictionary to merge.
- Returns:
A dictionary that is the result of merging the two input dictionaries.
- Return type:
dict