for epoch in range(5):
    model.train()
    running_loss = 0.0
    
    for data in trainloader:
    
        inputs, labels = data
        optimizer.zero_grad()
        outputs = model(inputs)
        loss = criterion(outputs, labels)
        loss.backward()
        optimizer.step()
        
        running_loss += loss.item()
        
    accuracy = evaluate(model)
        
    print(f"""Epoch {epoch + 1},
              Loss: {running_loss / len(trainloader)}, 
              Accuracy: {accuracy * 100:.2f}%
           """)

Training loop