text_plain_output_1.png
epochs = 100
for epoch in range(epochs):
    running_loss = 0.0
    for i, data in enumerate(train_data_loader, 0):
        inputs, labels = data
        inputs, labels = (inputs.cuda(), labels.cuda())
        optimizer.zero_grad()
        outputs = classifier(inputs)
        loss = criterion(outputs, labels)
        loss.backward()
        optimizer.step()
        running_loss += loss.item()
    average_loss = running_loss / len(train_data_loader)
    print('[%d] loss: %.8f' % (epoch + 1, average_loss))