/usr/local/lib64/python3.6/site-packages/torch/utils/data/datapipes/iter
NameSizeModeActions
__pycache__/-0755rm
callable.py89530644editdlrm
combinatorics.py43370644editdlrm
combining.py160280644editdlrm
filelister.py13850644editdlrm
fileloader.py19110644editdlrm
grouping.py129200644editdlrm
httpreader.py17640644editdlrm
linereader.py7320644editdlrm
routeddecoder.py23540644editdlrm
selecting.py60180644editdlrm
streamreader.py8220644editdlrm
tararchivereader.py29210644editdlrm
utils.py15010644editdlrm
ziparchivereader.py29210644editdlrm
__init__.py24630644editdlrm
Edit: /usr/local/lib64/python3.6/site-packages/torch/utils/data/datapipes/iter/utils.py (1501B)
import copy import warnings from torch.utils.data import IterDataPipe class IterableWrapperIterDataPipe(IterDataPipe): r""":class:`IterableWrapperIterDataPipe`. Iterable datapipe that wraps an iterable object. Args: iterable: Iterable object to be wrapped into an IterDataPipe deepcopy: Option to deepcopy input iterable object for each iteration. .. note:: If `deepcopy` is set to False explicitly, users should ensure that data pipeline doesn't contain any in-place operations over the iterable instance, in order to prevent data inconsistency across iterations. """ def __init__(self, iterable, deepcopy=True): self.iterable = iterable self.deepcopy = deepcopy def __iter__(self): source_data = self.iterable if self.deepcopy: try: source_data = copy.deepcopy(self.iterable) # For the case that data cannot be deep-copied, # all in-place operations will affect iterable variable. # When this DataPipe is iterated second time, it will # yield modified items. except TypeError: warnings.warn( "The input iterable can not be deepcopied, " "please be aware of in-place modification would affect source data" ) for data in source_data: yield data def __len__(self): return len(self.iterable)