IterToMapConverter
- class torchdata.datapipes.map.IterToMapConverter(datapipe: IterDataPipe, key_value_fn: Optional[Callable] = None)
Lazily load data from
IterDataPipe
to construct aMapDataPipe
with the key-value pair generated bykey_value_fn
(functional name:to_map_datapipe
). Ifkey_value_fn
is not given, each data from the source IterDataPipe must itself be an iterable with exactly two objects. The first object of each item becomes a key in the new dictionary, and the second object the corresponding value.- Parameters
datapipe – Source IterDataPipe
key_value_fn – Function being applied over each data to generate key-value pair
Note
If a key being added is already present, the corresponding value will be replaced by the new value.