replace_dp¶
- torchdata.dataloader2.graph.replace_dp(graph: Dict[int, Tuple[Union[IterDataPipe, MapDataPipe], Dict[int, Tuple[Union[IterDataPipe, MapDataPipe], DataPipeGraph]]]], old_datapipe: Union[IterDataPipe, MapDataPipe], new_datapipe: Union[IterDataPipe, MapDataPipe]) Dict[int, Tuple[Union[IterDataPipe, MapDataPipe], Dict[int, Tuple[Union[IterDataPipe, MapDataPipe], DataPipeGraph]]]] ¶
Given the graph of DataPipe generated by
traverse_dps
function and the DataPipe to be replaced and the new DataPipe, return the new graph of DataPipe.