Questions about the data loader

I have seen that there are two styles to load data.
First one is like this.

data_iter = iter(data_loader)
iter_per_epoch = len(data_loader)

for step in steps:
   if (step+1) % iter_per_epoch % ==0:
       data_iter = iter(data_loader)
   image, label = next(dat_iter) 
   print(image.shape)   #image shape : [batch_size, channel, width, height]

Another one is like this.

for epoch in epochs:
   for batch_idx, data in enumerate(mnist_train_loader):
       image, label = data
       print(image.shape) #image shape : [batch_size, channel, width, height]

I can’t understand the differences between them.
image.shape is same but first way do in steps and second way do in batch in epochs.

Anyone can help me to understand ?

Not much difference. A dataloader is just a regular python iterable. You can use it however you want :).