What is train_iterator

i am trying to understand how to create neural Network with pytorch, and i have find a code where it utilize a variable not declared above ; train_iterator and valid_iterator
what is this variables? and how can i create them?
the code create train_data via ImageFolder
‘’’ train_data = torchvision.datasets.ImageFolder(root= train_data_path,transform=transforms)’’’
the code is:
‘’'def train(model, optimizer, loss_fn, train_loader, val_loader, device=‘cpu’):
epochs =20

for epoch in range(epochs):
    print('training epoche  {}'.format(epoch))
    training_loss = 0.0
    valid_loss = 0.0
    for batch in train_loader:
        optimizer.zero_grad()    # reset the gradients to zero for the next batch iteration, if not the next batch
                                 # would have to deal with the previeuse batch's gradients as well as its own
        inputs, targets = batch    
        inputs = inputs.to(device)  # put inputs data to the device 
        target = targets.to(device)
        output = model(inputs)
        loss = loss_fn(output, target)
        loss.backward()             # compute gradients
        optimizer.step()            # use gradients, to adjust weights 
        training_loss += loss.data.item()
        print('loss =', loss)
    **training_loss /= len(train_iterator)**


Unfortunately the creation of train_iterator is not shown in your code snippet, but I guess it might have been created via:

train_iterator = iter(train_loader)

This would allow you to manually get the next batch via next(train_iterator), but you would have to take care of the StopIteration manually.

tanks for your replay