Thank you for your reply, @ptrblck.  So this means using torch.utils.data.DataLoader for trainloader , then batch_idxs in
for batch_idx, (images, targets) in enumerate(trainloader):
are indices for entire dataset?