Do you mean you want to iterate 3 times? If that’s true, you can do that using enumerate() and break the loop after 3 iterations as follows:
for i,(batch_x, batch_y) in enumerate(train_loader):
     print(batch_shape, batch_y.shape)
    if i == 2:
        break

Alternatively, you can do it as follows:
for i in range(3):
     batch_x, batch_y = next(iter(train_loader))
     print(batch_x,shape, batch_y.shape)