It does not work like that.
Each dataset has a length.
Concat dataset will generate a dataset of len1+len2.
It will shuffle randomly indices from both datasets and will generate a batch. If idx belongs to dataset1 it will call dataset1.getitem and so on.
You can expect that, statistically talking, each batch has half and half as it comes from a random distribution and len1 = len2 but it won’t ensure that.