from torch.utils.data.graph import traverse
from torchdata.datapipes.iter import IterDataPipe, IterableWrapper
class CustomIterDataPipe(IterDataPipe):
def noop(self, x):
return x
def __init__(self):
self._dp = IterableWrapper([]).map(self.noop)
def __iter__(self):
yield from self._dp
traverse(CustomIterDataPipe())
RecursionError: maximum recursion depth exceeded
Without the .map() call it works fine. I don't think this is specific to .map() though. From trying a few datapipes, this always happens if self._dp is composed in some way.
Without the
.map()call it works fine. I don't think this is specific to.map()though. From trying a few datapipes, this always happens ifself._dpis composed in some way.