gnn_tracking.utils.dictionaries#

Module Contents#

Functions#

add_key_prefix(→ dict[str, _P])

Return a copy of the dictionary with the prefix added to all keys.

add_key_suffix(→ dict[str, _P])

Return a copy of the dictionary with the suffix added to all keys.

subdict_with_prefix_stripped(→ dict[str, _P])

Return a copy of the dictionary for all keys that start with prefix

expand_grid(→ list[dict[str, Any]])

Expands a grid of parameters into a list of configurations.

pivot_record_list(→ dict)

Transform list of key value pairs into dict of lists.

to_floats(→ Any)

Convert all tensors in a datastructure to floats.

separate_init_kwargs(→ tuple[dict, dict])

Attributes#

_P

gnn_tracking.utils.dictionaries._P#
gnn_tracking.utils.dictionaries.add_key_prefix(dct: dict[str, _P], prefix: str = '') dict[str, _P]#

Return a copy of the dictionary with the prefix added to all keys.

gnn_tracking.utils.dictionaries.add_key_suffix(dct: dict[str, _P], suffix: str = '') dict[str, _P]#

Return a copy of the dictionary with the suffix added to all keys.

gnn_tracking.utils.dictionaries.subdict_with_prefix_stripped(dct: dict[str, _P], prefix: str = '') dict[str, _P]#

Return a copy of the dictionary for all keys that start with prefix and with the prefix removed from all keys.

gnn_tracking.utils.dictionaries.expand_grid(grid: dict[str, Sequence], fixed: dict[str, Sequence] | None = None) list[dict[str, Any]]#

Expands a grid of parameters into a list of configurations.

gnn_tracking.utils.dictionaries.pivot_record_list(records: list[dict]) dict#

Transform list of key value pairs into dict of lists.

gnn_tracking.utils.dictionaries.to_floats(inpt: Any) Any#

Convert all tensors in a datastructure to floats. Works on single tensors, lists, or dictionaries, nested or not.

gnn_tracking.utils.dictionaries.separate_init_kwargs(kwargs: dict, cls: type) tuple[dict, dict]#