We iterate on batches with the following code:
for batch in iterator: pass
where the iterator has been instantiated with the following code
train_iterator, valid_iterator, test_iterator = data.BucketIterator.splits( (train_data, valid_data, test_data), batch_size = BATCH_SIZE, device = device)
What I want to do is something like the following:
batch = next(iterator)
But this obviously does not work. The reason that I want such a think is that I want to iterate in two datasets (multitask learning) and so I want to have two iterators (one for each dataset), and be able to alternate between them.
Can you help me on that?