# AUTOGENERATED! DO NOT EDIT! File to edit: ../../nbs/ml.data.ipynb.

# %% auto 0
__all__ = ['ZippedDataset', 'ZippedDataLoader']

# %% ../../nbs/ml.data.ipynb 3
class ZippedDataset:
    def __init__(self, *datasets):
        self.datasets = datasets
    
    def __getitem__(self, idx):
        return tuple(ds[idx] for ds in self.datasets)
    
    def __len__(self):
        return min(len(ds) for ds in self.datasets)

# %% ../../nbs/ml.data.ipynb 4
class ZippedDataLoader:
    def __init__(self, *data_loaders):
        self.data_loaders = data_loaders

    def __iter__(self):
        self.it = iter(zip(*self.data_loaders))
        return self

    def __next__(self):
        return next(self.it)
