Thank you Kushaj. I am at the moment doing the same.
The problem is that ‘for’ loop ends when the batch_idx becomes min(len(loader1),len(loader2) )
Say for example a dataset1 has 1000 images and another dataset2 has 500. With this approach we will iterate only till 500 images in both the datasets. The remaining 500 images from dataset1 will not be used.
Hence, as I link it in my question, through a hack, I try to artificially increase the size of dataset2 to 1000 images. I wish to avoid this.