nip.utils.data

nip.utils.data#

Utilities for working with data.

Functions

dict_update_add(dictionary, key, value)

Update a dictionary by adding a value to a key.

forgetful_cycle(iterable)

Return an iterator that cycles through an iterable without saving copies.

is_nested_key(index)

Check whether an index is a nested key used in TensorDicts.

nested_dict_keys(data)

Get the keys of a nested dict as a list of tuples of strings.

nested_dict_keys_stringified(data[, separator])

Get the keys of a nested dict as a list of joined strings.

rename_dict_key(dictionary, old_key, new_key)

Rename a key in a dictionary, modifying the dictionary in place.

tensordict_to_numpy_dict(data)

Convert a TensorDict to a dict of numpy arrays.

truncated_iterator(iterable, maxlen)

Return an iterator that stops after a maximum length.

Classes

VariableDataCycler(dataloader[, device, ...])

A loader that cycles through data, but allows the batch size to vary.