I have two
DataLoaders with different numbers of examples in each. Each time a batch is taken from the primary
DataLoader, I want to sample a batch from the secondary
DataLoader. However, normally I would just iterate over the
DataLoader to extract batches. But the secondary
DataLoader being asked for samples within the primary
for loop iteration. How do I make sure the secondary
DataLoader provides a new batch of examples each time the primary
DataLoader's loop is being run? Thank you for your time!
EDIT: In normal Python,
cycle function might be used to create such an infinite iterator. Does this work with the
DataLoader iterator? Or are there problems using this approach based on how the
DataLoader is built?