traverse_dps¶
- torchdata.dataloader2.graph.traverse_dps(datapipe: Union[IterDataPipe, MapDataPipe]) Dict[int, Tuple[Union[IterDataPipe, MapDataPipe], Dict[int, Tuple[Union[IterDataPipe, MapDataPipe], DataPipeGraph]]]] ¶
Traverse the DataPipes and their attributes to extract the DataPipe graph. This only looks into the attribute from each DataPipe that is either a DataPipe and a Python collection object such as
list
,tuple
,set
anddict
.- Parameters:
datapipe – the end DataPipe of the graph
- Returns:
A graph represented as a nested dictionary, where keys are ids of DataPipe instances and values are tuples of DataPipe instance and the sub-graph