def __init__(
        self,
        tasks: Any,
        epoch_length: int,
        devices: int = 1,
        collate_fn: Optional[Callable] = default_collate,
    ):
        """This class is used to sample epoch_length tasks to represent an epoch.

        It should be used when using DataParallel

        Args:
            taskset: Dataset used to sample task.
            epoch_length: The expected epoch length. This requires to be divisible by devices.
            devices: Number of devices being used.
            collate_fn: The collate_fn to be applied on multiple tasks

        """
        self.tasks = tasks
        self.epoch_length = epoch_length
        self.devices = devices

        if epoch_length % devices != 0:
            raise Exception("The `epoch_length` should be the number of `devices`.")

        self.collate_fn = collate_fn
        self.counter = 0
This class is used to sample epoch_length tasks to represent an epoch.

        It should be used when using DataParallel

        Args:
            taskset: Dataset used to sample task.
            epoch_length: The expected epoch length. This requires to be divisible by devices.
            devices: Number of devices being used.
            collate_fn: The collate_fn to be applied on multiple tasks

        
src/flash/image/classification/integrations/learn2learn.py