I’m not sure to understand the use case completely.
If you are calling this line of core once per epoch, you would only get a single batch.
On the other hand, if you are calling it in each iteration, you are recreating the Iterator every time.
Could you try to iterate the DataLoader directly via:
for data, target in loader:
    ...

and check the results?