Not really, there is a class called dataset_concat already written. It is instantiated passing all the datasets and it will manage choose them as if a Dataset class were so that len_total = sum(len_i) and so on.
https://pytorch.org/docs/stable/data.html?highlight=concat#torch.utils.data.ConcatDataset 83