In an ideal case I prefer enumerating over dataloader with a for loop.
But for a particular implementation, I need multiple batches within one iteration in a sequence.
To do this I use, next(iter(dataloader)) to get as many batches as I need within one iteration.
The issue is, this causes linear increase in RAM over iterations and epochs. Somehow, the memory is not cleared after every iteration.
Any way I can avoid using iter and get multiple batches within one iteration?