Solved by Hakjin_Lee in post #2 
              
              
                I find my own solution. 
class NestedMetaDataset(torch.utils.data.Dataset):
    def __init__(self, load_dataset_class, classes, batch_size, **args):
        #self.datasets = [ClassDataset(load_dataset_class, cls, **args) for cls in classes]
        self.datasets = []
        self.len = 0

        fo…