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]]]] ¶
给定由
traverse_dps
函数生成的 DataPipe 图以及要替换的 DataPipe 和新的 DataPipe,返回新的 DataPipe 图。