ChainDataset is used for IterableDatasets 74, while ConcatDataset is used for the map-style datasets.



 Chris_Fleetwood:

Does ConcatDataset allow me to iterate over the matricies and the vector from 2 different datasets simulatenously?


No, as ConcatDataset will concatenate the passed datasets and won’t yield the samples simultaneously.
You could zip the DataLoaders and iterate them together:
dataset1 = TensorDataset(torch.zeros(10, 1), torch.zeros(10, 1))
dataset2 = TensorDataset(torch.ones(10, 1), torch.ones(10, 1))

loader1 = DataLoader(dataset1, num_workers=2, batch_size=2)
loader2 = DataLoader(dataset2, num_workers=2, batch_size=2)

for (x1, y1), (x2, y2) in zip(loader1, loader2):
    print(x1, y1)
    print(x2, y2)