The Dataloader loop (inner loop) corresponds to one epoch, so you should increase i outside of this loop:
for epoch in range(epochs):
    for batch_idx, (data, target) in enumerate(loader):
        print('Epoch {}, iter {}'.format(epoch, batch_idx))