Cnn model using pytorch
I have images and labels. I divided them into test and train sets.
(xtrain,
ytrain,
xtest,
ytest).
x refers to images and y refers to label.
How to use these sets in the following train model
 **# Train the model
  total_step = len(train_loader)
 for epoch in range(num_epochs):
   for i, (images, labels) in enumerate(train_loader):
    images = images.to(device)
    labels = labels.to(device)
    
    # Forward pass
    outputs = model(images)
    loss = criterion(outputs, labels)
    
    # Backward and optimize
    optimizer.zero_grad()
    loss.backward()
    optimizer.step()
    
    if (i+1) % 100 == 0:
        print ('Epoch [{}/{}], Step [{}/{}], Loss: {:.4f}' 
               .format(epoch+1, num_epochs, i+1, total_step, loss.item()))
 # Test the model
 model.eval()  # eval mode (batchnorm uses moving mean/variance instead of mini-batch                           
                       mean/variance)**


from torch.utils.data import Dataset, DataLoader
training_set = Dataset(xtrain, ytrain)
test_set = Dataset(xtest, ytest)
params = {'batch_size': 64,
        'shuffle': True}
train_loader = DataLoader(training_set, **params)

