def __len__()

in torchdata/datapipes/iter/util/header.py [0:0]


    def __len__(self) -> int:
        if self.length != -1:
            return self.length
        try:
            source_len = len(self.source_datapipe)
            self.length = min(source_len, self.limit)
            return self.length
        except TypeError:
            warn(
                "The length of this HeaderIterDataPipe is inferred to be equal to its limit."
                "The actual value may be smaller if the actual length of source_datapipe is smaller than the limit."
            )
            return self.limit