'Args:
ds (DataFlow): the input DataFlow.
infinite (bool): When set to False, will raise StopIteration when
ds is exhausted.'

def __init__(self, ds, infinite=True):

    assert isinstance(ds, DataFlow), ds
    self.ds = ds
    if infinite:
        self._iter_ds = RepeatedData(self.ds, (-1))
    else:
        self._iter_ds = self.ds
