Skip to content

Graph traversal is broken for custom iter datapipes #237

@pmeier

Description

@pmeier
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions