Could you check the length of the trainloader via print(len(trainloader))? This should return the number of batches and iterations in this loop.
Assuming you are using the map-style Dataset, which implements the __len__ method, each epoch should only yield the specified number of samples.