First of all, import all needed packages, particularly: torch and torchvision.
# Original Source: https://github.com/pytorch/examples/blob/master/mnist/main.py
# Code from: https://github.com/jiapei100/PyTorchZeroToAll/blob/master/10_1_cnn_mnist.py
from __future__ import print_function
import argparse
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchvision import datasets, transforms
from torch.autograd import Variable
Loading MNIST dataset. You'll see 4 datasets are downloaded during the running process.
# Training settings
batch_size = 64
# MNIST Dataset
train_dataset = datasets.MNIST(root='./data/',
train=True,
transform=transforms.ToTensor(),
download=True)
test_dataset = datasets.MNIST(root='./data/',
train=False,
transform=transforms.ToTensor())
# Data Loader (Input Pipeline)
train_loader = torch.utils.data.DataLoader(dataset=train_dataset,
batch_size=batch_size,
shuffle=True)
test_loader = torch.utils.data.DataLoader(dataset=test_dataset,
batch_size=batch_size,
shuffle=False)
Afterwards, define CNN
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.conv1 = nn.Conv2d(1, 10, kernel_size=5)
self.conv2 = nn.Conv2d(10, 20, kernel_size=5)
self.mp = nn.MaxPool2d(2)
self.fc = nn.Linear(320, 10)
def forward(self, x):
in_size = x.size(0)
x = F.relu(self.mp(self.conv1(x)))
x = F.relu(self.mp(self.conv2(x)))
x = x.view(in_size, -1) # flatten the tensor
x = self.fc(x)
return F.log_softmax(x, dim=1)
model = Net()
optimizer = optim.SGD(model.parameters(), lr=0.01, momentum=0.5)
Define training function
def train(epoch):
model.train()
for batch_idx, (data, target) in enumerate(train_loader):
data, target = Variable(data), Variable(target)
optimizer.zero_grad()
output = model(data)
loss = F.nll_loss(output, target)
loss.backward()
optimizer.step()
if batch_idx % 10 == 0:
print('Train Epoch: {} [{}/{} ({:.0f}%)]\tLoss: {:.6f}'.format(
epoch, batch_idx * len(data), len(train_loader.dataset),
100. * batch_idx / len(train_loader), loss.item()))
Define testing function
def test():
model.eval()
test_loss = 0
correct = 0
for data, target in test_loader:
data, target = Variable(data, requires_grad=True), Variable(target)
with torch.no_grad():
output = model(data)
# sum up batch loss
test_loss += F.nll_loss(output, target, size_average=False).item()
# get the index of the max log-probability
pred = output.data.max(1, keepdim=True)[1]
correct += pred.eq(target.data.view_as(pred)).cpu().sum()
test_loss /= len(test_loader.dataset)
print('\nTest set: Average loss: {:.4f}, Accuracy: {}/{} ({:.0f}%)\n'.format(
test_loss, correct, len(test_loader.dataset),
100. * correct / len(test_loader.dataset)))
Train and test
for epoch in range(1, 10):
train(epoch)
test()
Train Epoch: 1 [0/60000 (0%)] Loss: 2.302750 Train Epoch: 1 [640/60000 (1%)] Loss: 2.294239 Train Epoch: 1 [1280/60000 (2%)] Loss: 2.277666 Train Epoch: 1 [1920/60000 (3%)] Loss: 2.275154 Train Epoch: 1 [2560/60000 (4%)] Loss: 2.284332 Train Epoch: 1 [3200/60000 (5%)] Loss: 2.237666 Train Epoch: 1 [3840/60000 (6%)] Loss: 2.236258 Train Epoch: 1 [4480/60000 (7%)] Loss: 2.176656 Train Epoch: 1 [5120/60000 (9%)] Loss: 2.151426 Train Epoch: 1 [5760/60000 (10%)] Loss: 2.097822 Train Epoch: 1 [6400/60000 (11%)] Loss: 1.962065 Train Epoch: 1 [7040/60000 (12%)] Loss: 1.853730 Train Epoch: 1 [7680/60000 (13%)] Loss: 1.654715 Train Epoch: 1 [8320/60000 (14%)] Loss: 1.282262 Train Epoch: 1 [8960/60000 (15%)] Loss: 1.057662 Train Epoch: 1 [9600/60000 (16%)] Loss: 0.985463 Train Epoch: 1 [10240/60000 (17%)] Loss: 0.880024 Train Epoch: 1 [10880/60000 (18%)] Loss: 0.574015 Train Epoch: 1 [11520/60000 (19%)] Loss: 0.623674 Train Epoch: 1 [12160/60000 (20%)] Loss: 0.607889 Train Epoch: 1 [12800/60000 (21%)] Loss: 0.657456 Train Epoch: 1 [13440/60000 (22%)] Loss: 0.406524 Train Epoch: 1 [14080/60000 (23%)] Loss: 0.560448 Train Epoch: 1 [14720/60000 (25%)] Loss: 0.602153 Train Epoch: 1 [15360/60000 (26%)] Loss: 0.521870 Train Epoch: 1 [16000/60000 (27%)] Loss: 0.355486 Train Epoch: 1 [16640/60000 (28%)] Loss: 0.467051 Train Epoch: 1 [17280/60000 (29%)] Loss: 0.689880 Train Epoch: 1 [17920/60000 (30%)] Loss: 0.477837 Train Epoch: 1 [18560/60000 (31%)] Loss: 0.421290 Train Epoch: 1 [19200/60000 (32%)] Loss: 0.328729 Train Epoch: 1 [19840/60000 (33%)] Loss: 0.279361 Train Epoch: 1 [20480/60000 (34%)] Loss: 0.440283 Train Epoch: 1 [21120/60000 (35%)] Loss: 0.647068 Train Epoch: 1 [21760/60000 (36%)] Loss: 0.340216 Train Epoch: 1 [22400/60000 (37%)] Loss: 0.185844 Train Epoch: 1 [23040/60000 (38%)] Loss: 0.370772 Train Epoch: 1 [23680/60000 (39%)] Loss: 0.604638 Train Epoch: 1 [24320/60000 (41%)] Loss: 0.289473 Train Epoch: 1 [24960/60000 (42%)] Loss: 0.371890 Train Epoch: 1 [25600/60000 (43%)] Loss: 0.338951 Train Epoch: 1 [26240/60000 (44%)] Loss: 0.377979 Train Epoch: 1 [26880/60000 (45%)] Loss: 0.475583 Train Epoch: 1 [27520/60000 (46%)] Loss: 0.212702 Train Epoch: 1 [28160/60000 (47%)] Loss: 0.234694 Train Epoch: 1 [28800/60000 (48%)] Loss: 0.338335 Train Epoch: 1 [29440/60000 (49%)] Loss: 0.403380 Train Epoch: 1 [30080/60000 (50%)] Loss: 0.299236 Train Epoch: 1 [30720/60000 (51%)] Loss: 0.371117 Train Epoch: 1 [31360/60000 (52%)] Loss: 0.326608 Train Epoch: 1 [32000/60000 (53%)] Loss: 0.362611 Train Epoch: 1 [32640/60000 (54%)] Loss: 0.144903 Train Epoch: 1 [33280/60000 (55%)] Loss: 0.354083 Train Epoch: 1 [33920/60000 (57%)] Loss: 0.296097 Train Epoch: 1 [34560/60000 (58%)] Loss: 0.365376 Train Epoch: 1 [35200/60000 (59%)] Loss: 0.324697 Train Epoch: 1 [35840/60000 (60%)] Loss: 0.572151 Train Epoch: 1 [36480/60000 (61%)] Loss: 0.236434 Train Epoch: 1 [37120/60000 (62%)] Loss: 0.212732 Train Epoch: 1 [37760/60000 (63%)] Loss: 0.383258 Train Epoch: 1 [38400/60000 (64%)] Loss: 0.349251 Train Epoch: 1 [39040/60000 (65%)] Loss: 0.387144 Train Epoch: 1 [39680/60000 (66%)] Loss: 0.318350 Train Epoch: 1 [40320/60000 (67%)] Loss: 0.404448 Train Epoch: 1 [40960/60000 (68%)] Loss: 0.172462 Train Epoch: 1 [41600/60000 (69%)] Loss: 0.264691 Train Epoch: 1 [42240/60000 (70%)] Loss: 0.272144 Train Epoch: 1 [42880/60000 (71%)] Loss: 0.195797 Train Epoch: 1 [43520/60000 (72%)] Loss: 0.304537 Train Epoch: 1 [44160/60000 (74%)] Loss: 0.282850 Train Epoch: 1 [44800/60000 (75%)] Loss: 0.329202 Train Epoch: 1 [45440/60000 (76%)] Loss: 0.310663 Train Epoch: 1 [46080/60000 (77%)] Loss: 0.144039 Train Epoch: 1 [46720/60000 (78%)] Loss: 0.276784 Train Epoch: 1 [47360/60000 (79%)] Loss: 0.207992 Train Epoch: 1 [48000/60000 (80%)] Loss: 0.283097 Train Epoch: 1 [48640/60000 (81%)] Loss: 0.159823 Train Epoch: 1 [49280/60000 (82%)] Loss: 0.356448 Train Epoch: 1 [49920/60000 (83%)] Loss: 0.273224 Train Epoch: 1 [50560/60000 (84%)] Loss: 0.134302 Train Epoch: 1 [51200/60000 (85%)] Loss: 0.252466 Train Epoch: 1 [51840/60000 (86%)] Loss: 0.296629 Train Epoch: 1 [52480/60000 (87%)] Loss: 0.136439 Train Epoch: 1 [53120/60000 (88%)] Loss: 0.226093 Train Epoch: 1 [53760/60000 (90%)] Loss: 0.241420 Train Epoch: 1 [54400/60000 (91%)] Loss: 0.308084 Train Epoch: 1 [55040/60000 (92%)] Loss: 0.116024 Train Epoch: 1 [55680/60000 (93%)] Loss: 0.215715 Train Epoch: 1 [56320/60000 (94%)] Loss: 0.211644 Train Epoch: 1 [56960/60000 (95%)] Loss: 0.217347 Train Epoch: 1 [57600/60000 (96%)] Loss: 0.259077 Train Epoch: 1 [58240/60000 (97%)] Loss: 0.241611 Train Epoch: 1 [58880/60000 (98%)] Loss: 0.202261 Train Epoch: 1 [59520/60000 (99%)] Loss: 0.084446 Test set: Average loss: 0.1844, Accuracy: 9473/10000 (95%) Train Epoch: 2 [0/60000 (0%)] Loss: 0.335339 Train Epoch: 2 [640/60000 (1%)] Loss: 0.101215 Train Epoch: 2 [1280/60000 (2%)] Loss: 0.125136 Train Epoch: 2 [1920/60000 (3%)] Loss: 0.205086 Train Epoch: 2 [2560/60000 (4%)] Loss: 0.210856 Train Epoch: 2 [3200/60000 (5%)] Loss: 0.213990 Train Epoch: 2 [3840/60000 (6%)] Loss: 0.214273 Train Epoch: 2 [4480/60000 (7%)] Loss: 0.393762 Train Epoch: 2 [5120/60000 (9%)] Loss: 0.190642 Train Epoch: 2 [5760/60000 (10%)] Loss: 0.099488 Train Epoch: 2 [6400/60000 (11%)] Loss: 0.169744 Train Epoch: 2 [7040/60000 (12%)] Loss: 0.203104 Train Epoch: 2 [7680/60000 (13%)] Loss: 0.120816 Train Epoch: 2 [8320/60000 (14%)] Loss: 0.150728 Train Epoch: 2 [8960/60000 (15%)] Loss: 0.229119 Train Epoch: 2 [9600/60000 (16%)] Loss: 0.091388 Train Epoch: 2 [10240/60000 (17%)] Loss: 0.100694 Train Epoch: 2 [10880/60000 (18%)] Loss: 0.222582 Train Epoch: 2 [11520/60000 (19%)] Loss: 0.126701 Train Epoch: 2 [12160/60000 (20%)] Loss: 0.297048 Train Epoch: 2 [12800/60000 (21%)] Loss: 0.174746 Train Epoch: 2 [13440/60000 (22%)] Loss: 0.451948 Train Epoch: 2 [14080/60000 (23%)] Loss: 0.133486 Train Epoch: 2 [14720/60000 (25%)] Loss: 0.291300 Train Epoch: 2 [15360/60000 (26%)] Loss: 0.184698 Train Epoch: 2 [16000/60000 (27%)] Loss: 0.110213 Train Epoch: 2 [16640/60000 (28%)] Loss: 0.162748 Train Epoch: 2 [17280/60000 (29%)] Loss: 0.143355 Train Epoch: 2 [17920/60000 (30%)] Loss: 0.213226 Train Epoch: 2 [18560/60000 (31%)] Loss: 0.132270 Train Epoch: 2 [19200/60000 (32%)] Loss: 0.224205 Train Epoch: 2 [19840/60000 (33%)] Loss: 0.115983 Train Epoch: 2 [20480/60000 (34%)] Loss: 0.227553 Train Epoch: 2 [21120/60000 (35%)] Loss: 0.169280 Train Epoch: 2 [21760/60000 (36%)] Loss: 0.089836 Train Epoch: 2 [22400/60000 (37%)] Loss: 0.140270 Train Epoch: 2 [23040/60000 (38%)] Loss: 0.126178 Train Epoch: 2 [23680/60000 (39%)] Loss: 0.157805 Train Epoch: 2 [24320/60000 (41%)] Loss: 0.185493 Train Epoch: 2 [24960/60000 (42%)] Loss: 0.380474 Train Epoch: 2 [25600/60000 (43%)] Loss: 0.087696 Train Epoch: 2 [26240/60000 (44%)] Loss: 0.053152 Train Epoch: 2 [26880/60000 (45%)] Loss: 0.279660 Train Epoch: 2 [27520/60000 (46%)] Loss: 0.070056 Train Epoch: 2 [28160/60000 (47%)] Loss: 0.132298 Train Epoch: 2 [28800/60000 (48%)] Loss: 0.107575 Train Epoch: 2 [29440/60000 (49%)] Loss: 0.249032 Train Epoch: 2 [30080/60000 (50%)] Loss: 0.117548 Train Epoch: 2 [30720/60000 (51%)] Loss: 0.167482 Train Epoch: 2 [31360/60000 (52%)] Loss: 0.179214 Train Epoch: 2 [32000/60000 (53%)] Loss: 0.098969 Train Epoch: 2 [32640/60000 (54%)] Loss: 0.182664 Train Epoch: 2 [33280/60000 (55%)] Loss: 0.063118 Train Epoch: 2 [33920/60000 (57%)] Loss: 0.123099 Train Epoch: 2 [34560/60000 (58%)] Loss: 0.142745 Train Epoch: 2 [35200/60000 (59%)] Loss: 0.096934 Train Epoch: 2 [35840/60000 (60%)] Loss: 0.053674 Train Epoch: 2 [36480/60000 (61%)] Loss: 0.147441 Train Epoch: 2 [37120/60000 (62%)] Loss: 0.277926 Train Epoch: 2 [37760/60000 (63%)] Loss: 0.246985 Train Epoch: 2 [38400/60000 (64%)] Loss: 0.343751 Train Epoch: 2 [39040/60000 (65%)] Loss: 0.083396 Train Epoch: 2 [39680/60000 (66%)] Loss: 0.097020 Train Epoch: 2 [40320/60000 (67%)] Loss: 0.374275 Train Epoch: 2 [40960/60000 (68%)] Loss: 0.264117 Train Epoch: 2 [41600/60000 (69%)] Loss: 0.096749 Train Epoch: 2 [42240/60000 (70%)] Loss: 0.372819 Train Epoch: 2 [42880/60000 (71%)] Loss: 0.314999 Train Epoch: 2 [43520/60000 (72%)] Loss: 0.151405 Train Epoch: 2 [44160/60000 (74%)] Loss: 0.107737 Train Epoch: 2 [44800/60000 (75%)] Loss: 0.128466 Train Epoch: 2 [45440/60000 (76%)] Loss: 0.053797 Train Epoch: 2 [46080/60000 (77%)] Loss: 0.154935 Train Epoch: 2 [46720/60000 (78%)] Loss: 0.194024 Train Epoch: 2 [47360/60000 (79%)] Loss: 0.294160 Train Epoch: 2 [48000/60000 (80%)] Loss: 0.099992 Train Epoch: 2 [48640/60000 (81%)] Loss: 0.087606 Train Epoch: 2 [49280/60000 (82%)] Loss: 0.183729 Train Epoch: 2 [49920/60000 (83%)] Loss: 0.141140 Train Epoch: 2 [50560/60000 (84%)] Loss: 0.125951 Train Epoch: 2 [51200/60000 (85%)] Loss: 0.123601 Train Epoch: 2 [51840/60000 (86%)] Loss: 0.118632 Train Epoch: 2 [52480/60000 (87%)] Loss: 0.148925 Train Epoch: 2 [53120/60000 (88%)] Loss: 0.099077 Train Epoch: 2 [53760/60000 (90%)] Loss: 0.085571 Train Epoch: 2 [54400/60000 (91%)] Loss: 0.195109 Train Epoch: 2 [55040/60000 (92%)] Loss: 0.227440 Train Epoch: 2 [55680/60000 (93%)] Loss: 0.164445 Train Epoch: 2 [56320/60000 (94%)] Loss: 0.260439 Train Epoch: 2 [56960/60000 (95%)] Loss: 0.159982 Train Epoch: 2 [57600/60000 (96%)] Loss: 0.029597 Train Epoch: 2 [58240/60000 (97%)] Loss: 0.105098 Train Epoch: 2 [58880/60000 (98%)] Loss: 0.196359 Train Epoch: 2 [59520/60000 (99%)] Loss: 0.070338 Test set: Average loss: 0.1250, Accuracy: 9608/10000 (96%) Train Epoch: 3 [0/60000 (0%)] Loss: 0.040007 Train Epoch: 3 [640/60000 (1%)] Loss: 0.248919 Train Epoch: 3 [1280/60000 (2%)] Loss: 0.074527 Train Epoch: 3 [1920/60000 (3%)] Loss: 0.189133 Train Epoch: 3 [2560/60000 (4%)] Loss: 0.093020 Train Epoch: 3 [3200/60000 (5%)] Loss: 0.053741 Train Epoch: 3 [3840/60000 (6%)] Loss: 0.180040 Train Epoch: 3 [4480/60000 (7%)] Loss: 0.139165 Train Epoch: 3 [5120/60000 (9%)] Loss: 0.057119 Train Epoch: 3 [5760/60000 (10%)] Loss: 0.204343 Train Epoch: 3 [6400/60000 (11%)] Loss: 0.220169 Train Epoch: 3 [7040/60000 (12%)] Loss: 0.063202 Train Epoch: 3 [7680/60000 (13%)] Loss: 0.085821 Train Epoch: 3 [8320/60000 (14%)] Loss: 0.142111 Train Epoch: 3 [8960/60000 (15%)] Loss: 0.078984 Train Epoch: 3 [9600/60000 (16%)] Loss: 0.241192 Train Epoch: 3 [10240/60000 (17%)] Loss: 0.097471 Train Epoch: 3 [10880/60000 (18%)] Loss: 0.215299 Train Epoch: 3 [11520/60000 (19%)] Loss: 0.143464 Train Epoch: 3 [12160/60000 (20%)] Loss: 0.061797 Train Epoch: 3 [12800/60000 (21%)] Loss: 0.290972 Train Epoch: 3 [13440/60000 (22%)] Loss: 0.155117 Train Epoch: 3 [14080/60000 (23%)] Loss: 0.199297 Train Epoch: 3 [14720/60000 (25%)] Loss: 0.033213 Train Epoch: 3 [15360/60000 (26%)] Loss: 0.081352 Train Epoch: 3 [16000/60000 (27%)] Loss: 0.191277 Train Epoch: 3 [16640/60000 (28%)] Loss: 0.047808 Train Epoch: 3 [17280/60000 (29%)] Loss: 0.107605 Train Epoch: 3 [17920/60000 (30%)] Loss: 0.063272 Train Epoch: 3 [18560/60000 (31%)] Loss: 0.292712 Train Epoch: 3 [19200/60000 (32%)] Loss: 0.243092 Train Epoch: 3 [19840/60000 (33%)] Loss: 0.099812 Train Epoch: 3 [20480/60000 (34%)] Loss: 0.028680 Train Epoch: 3 [21120/60000 (35%)] Loss: 0.403855 Train Epoch: 3 [21760/60000 (36%)] Loss: 0.304837 Train Epoch: 3 [22400/60000 (37%)] Loss: 0.070343 Train Epoch: 3 [23040/60000 (38%)] Loss: 0.090552 Train Epoch: 3 [23680/60000 (39%)] Loss: 0.069524 Train Epoch: 3 [24320/60000 (41%)] Loss: 0.035546 Train Epoch: 3 [24960/60000 (42%)] Loss: 0.082431 Train Epoch: 3 [25600/60000 (43%)] Loss: 0.079616 Train Epoch: 3 [26240/60000 (44%)] Loss: 0.152923 Train Epoch: 3 [26880/60000 (45%)] Loss: 0.178527 Train Epoch: 3 [27520/60000 (46%)] Loss: 0.098369 Train Epoch: 3 [28160/60000 (47%)] Loss: 0.056504 Train Epoch: 3 [28800/60000 (48%)] Loss: 0.123448 Train Epoch: 3 [29440/60000 (49%)] Loss: 0.186487 Train Epoch: 3 [30080/60000 (50%)] Loss: 0.112392 Train Epoch: 3 [30720/60000 (51%)] Loss: 0.141171 Train Epoch: 3 [31360/60000 (52%)] Loss: 0.076075 Train Epoch: 3 [32000/60000 (53%)] Loss: 0.290630 Train Epoch: 3 [32640/60000 (54%)] Loss: 0.071515 Train Epoch: 3 [33280/60000 (55%)] Loss: 0.114186 Train Epoch: 3 [33920/60000 (57%)] Loss: 0.222755 Train Epoch: 3 [34560/60000 (58%)] Loss: 0.120789 Train Epoch: 3 [35200/60000 (59%)] Loss: 0.157404 Train Epoch: 3 [35840/60000 (60%)] Loss: 0.211034 Train Epoch: 3 [36480/60000 (61%)] Loss: 0.075546 Train Epoch: 3 [37120/60000 (62%)] Loss: 0.117283 Train Epoch: 3 [37760/60000 (63%)] Loss: 0.081512 Train Epoch: 3 [38400/60000 (64%)] Loss: 0.232778 Train Epoch: 3 [39040/60000 (65%)] Loss: 0.180055 Train Epoch: 3 [39680/60000 (66%)] Loss: 0.156425 Train Epoch: 3 [40320/60000 (67%)] Loss: 0.060988 Train Epoch: 3 [40960/60000 (68%)] Loss: 0.411666 Train Epoch: 3 [41600/60000 (69%)] Loss: 0.080556 Train Epoch: 3 [42240/60000 (70%)] Loss: 0.045654 Train Epoch: 3 [42880/60000 (71%)] Loss: 0.208916 Train Epoch: 3 [43520/60000 (72%)] Loss: 0.020835 Train Epoch: 3 [44160/60000 (74%)] Loss: 0.052317 Train Epoch: 3 [44800/60000 (75%)] Loss: 0.069176 Train Epoch: 3 [45440/60000 (76%)] Loss: 0.146859 Train Epoch: 3 [46080/60000 (77%)] Loss: 0.100137 Train Epoch: 3 [46720/60000 (78%)] Loss: 0.037533 Train Epoch: 3 [47360/60000 (79%)] Loss: 0.083994 Train Epoch: 3 [48000/60000 (80%)] Loss: 0.165170 Train Epoch: 3 [48640/60000 (81%)] Loss: 0.060811 Train Epoch: 3 [49280/60000 (82%)] Loss: 0.048009 Train Epoch: 3 [49920/60000 (83%)] Loss: 0.063743 Train Epoch: 3 [50560/60000 (84%)] Loss: 0.079445 Train Epoch: 3 [51200/60000 (85%)] Loss: 0.069600 Train Epoch: 3 [51840/60000 (86%)] Loss: 0.072246 Train Epoch: 3 [52480/60000 (87%)] Loss: 0.127083 Train Epoch: 3 [53120/60000 (88%)] Loss: 0.049970 Train Epoch: 3 [53760/60000 (90%)] Loss: 0.070174 Train Epoch: 3 [54400/60000 (91%)] Loss: 0.197476 Train Epoch: 3 [55040/60000 (92%)] Loss: 0.030663 Train Epoch: 3 [55680/60000 (93%)] Loss: 0.047972 Train Epoch: 3 [56320/60000 (94%)] Loss: 0.106370 Train Epoch: 3 [56960/60000 (95%)] Loss: 0.098763 Train Epoch: 3 [57600/60000 (96%)] Loss: 0.120673 Train Epoch: 3 [58240/60000 (97%)] Loss: 0.105097 Train Epoch: 3 [58880/60000 (98%)] Loss: 0.216811 Train Epoch: 3 [59520/60000 (99%)] Loss: 0.030821 Test set: Average loss: 0.0861, Accuracy: 9740/10000 (97%) Train Epoch: 4 [0/60000 (0%)] Loss: 0.058603 Train Epoch: 4 [640/60000 (1%)] Loss: 0.068518 Train Epoch: 4 [1280/60000 (2%)] Loss: 0.045707 Train Epoch: 4 [1920/60000 (3%)] Loss: 0.124151 Train Epoch: 4 [2560/60000 (4%)] Loss: 0.131996 Train Epoch: 4 [3200/60000 (5%)] Loss: 0.103385 Train Epoch: 4 [3840/60000 (6%)] Loss: 0.057419 Train Epoch: 4 [4480/60000 (7%)] Loss: 0.171233 Train Epoch: 4 [5120/60000 (9%)] Loss: 0.057822 Train Epoch: 4 [5760/60000 (10%)] Loss: 0.099908 Train Epoch: 4 [6400/60000 (11%)] Loss: 0.068817 Train Epoch: 4 [7040/60000 (12%)] Loss: 0.040263 Train Epoch: 4 [7680/60000 (13%)] Loss: 0.103096 Train Epoch: 4 [8320/60000 (14%)] Loss: 0.068251 Train Epoch: 4 [8960/60000 (15%)] Loss: 0.075589 Train Epoch: 4 [9600/60000 (16%)] Loss: 0.255151 Train Epoch: 4 [10240/60000 (17%)] Loss: 0.021581 Train Epoch: 4 [10880/60000 (18%)] Loss: 0.064106 Train Epoch: 4 [11520/60000 (19%)] Loss: 0.050146 Train Epoch: 4 [12160/60000 (20%)] Loss: 0.060758 Train Epoch: 4 [12800/60000 (21%)] Loss: 0.150228 Train Epoch: 4 [13440/60000 (22%)] Loss: 0.077774 Train Epoch: 4 [14080/60000 (23%)] Loss: 0.123523 Train Epoch: 4 [14720/60000 (25%)] Loss: 0.057074 Train Epoch: 4 [15360/60000 (26%)] Loss: 0.092370 Train Epoch: 4 [16000/60000 (27%)] Loss: 0.111632 Train Epoch: 4 [16640/60000 (28%)] Loss: 0.042093 Train Epoch: 4 [17280/60000 (29%)] Loss: 0.039304 Train Epoch: 4 [17920/60000 (30%)] Loss: 0.119649 Train Epoch: 4 [18560/60000 (31%)] Loss: 0.163330 Train Epoch: 4 [19200/60000 (32%)] Loss: 0.035465 Train Epoch: 4 [19840/60000 (33%)] Loss: 0.074450 Train Epoch: 4 [20480/60000 (34%)] Loss: 0.065414 Train Epoch: 4 [21120/60000 (35%)] Loss: 0.040539 Train Epoch: 4 [21760/60000 (36%)] Loss: 0.148224 Train Epoch: 4 [22400/60000 (37%)] Loss: 0.156781 Train Epoch: 4 [23040/60000 (38%)] Loss: 0.045047 Train Epoch: 4 [23680/60000 (39%)] Loss: 0.055257 Train Epoch: 4 [24320/60000 (41%)] Loss: 0.054676 Train Epoch: 4 [24960/60000 (42%)] Loss: 0.158515 Train Epoch: 4 [25600/60000 (43%)] Loss: 0.128929 Train Epoch: 4 [26240/60000 (44%)] Loss: 0.108329 Train Epoch: 4 [26880/60000 (45%)] Loss: 0.135030 Train Epoch: 4 [27520/60000 (46%)] Loss: 0.039639 Train Epoch: 4 [28160/60000 (47%)] Loss: 0.033988 Train Epoch: 4 [28800/60000 (48%)] Loss: 0.026609 Train Epoch: 4 [29440/60000 (49%)] Loss: 0.034178 Train Epoch: 4 [30080/60000 (50%)] Loss: 0.046107 Train Epoch: 4 [30720/60000 (51%)] Loss: 0.011578 Train Epoch: 4 [31360/60000 (52%)] Loss: 0.110122 Train Epoch: 4 [32000/60000 (53%)] Loss: 0.103868 Train Epoch: 4 [32640/60000 (54%)] Loss: 0.151878 Train Epoch: 4 [33280/60000 (55%)] Loss: 0.043182 Train Epoch: 4 [33920/60000 (57%)] Loss: 0.124207 Train Epoch: 4 [34560/60000 (58%)] Loss: 0.080034 Train Epoch: 4 [35200/60000 (59%)] Loss: 0.162287 Train Epoch: 4 [35840/60000 (60%)] Loss: 0.126800 Train Epoch: 4 [36480/60000 (61%)] Loss: 0.061211 Train Epoch: 4 [37120/60000 (62%)] Loss: 0.102037 Train Epoch: 4 [37760/60000 (63%)] Loss: 0.059467 Train Epoch: 4 [38400/60000 (64%)] Loss: 0.194096 Train Epoch: 4 [39040/60000 (65%)] Loss: 0.106487 Train Epoch: 4 [39680/60000 (66%)] Loss: 0.044351 Train Epoch: 4 [40320/60000 (67%)] Loss: 0.089831 Train Epoch: 4 [40960/60000 (68%)] Loss: 0.099313 Train Epoch: 4 [41600/60000 (69%)] Loss: 0.036939 Train Epoch: 4 [42240/60000 (70%)] Loss: 0.137625 Train Epoch: 4 [42880/60000 (71%)] Loss: 0.095748 Train Epoch: 4 [43520/60000 (72%)] Loss: 0.080863 Train Epoch: 4 [44160/60000 (74%)] Loss: 0.078053 Train Epoch: 4 [44800/60000 (75%)] Loss: 0.200218 Train Epoch: 4 [45440/60000 (76%)] Loss: 0.098379 Train Epoch: 4 [46080/60000 (77%)] Loss: 0.039777 Train Epoch: 4 [46720/60000 (78%)] Loss: 0.041870 Train Epoch: 4 [47360/60000 (79%)] Loss: 0.044499 Train Epoch: 4 [48000/60000 (80%)] Loss: 0.088943 Train Epoch: 4 [48640/60000 (81%)] Loss: 0.122270 Train Epoch: 4 [49280/60000 (82%)] Loss: 0.139814 Train Epoch: 4 [49920/60000 (83%)] Loss: 0.170997 Train Epoch: 4 [50560/60000 (84%)] Loss: 0.076264 Train Epoch: 4 [51200/60000 (85%)] Loss: 0.035964 Train Epoch: 4 [51840/60000 (86%)] Loss: 0.050548 Train Epoch: 4 [52480/60000 (87%)] Loss: 0.028624 Train Epoch: 4 [53120/60000 (88%)] Loss: 0.017791 Train Epoch: 4 [53760/60000 (90%)] Loss: 0.167684 Train Epoch: 4 [54400/60000 (91%)] Loss: 0.127051 Train Epoch: 4 [55040/60000 (92%)] Loss: 0.087644 Train Epoch: 4 [55680/60000 (93%)] Loss: 0.214866 Train Epoch: 4 [56320/60000 (94%)] Loss: 0.118833 Train Epoch: 4 [56960/60000 (95%)] Loss: 0.031988 Train Epoch: 4 [57600/60000 (96%)] Loss: 0.060099 Train Epoch: 4 [58240/60000 (97%)] Loss: 0.107616 Train Epoch: 4 [58880/60000 (98%)] Loss: 0.107447 Train Epoch: 4 [59520/60000 (99%)] Loss: 0.052308 Test set: Average loss: 0.0799, Accuracy: 9755/10000 (98%) Train Epoch: 5 [0/60000 (0%)] Loss: 0.066949 Train Epoch: 5 [640/60000 (1%)] Loss: 0.105724 Train Epoch: 5 [1280/60000 (2%)] Loss: 0.045400 Train Epoch: 5 [1920/60000 (3%)] Loss: 0.109869 Train Epoch: 5 [2560/60000 (4%)] Loss: 0.039605 Train Epoch: 5 [3200/60000 (5%)] Loss: 0.257772 Train Epoch: 5 [3840/60000 (6%)] Loss: 0.041636 Train Epoch: 5 [4480/60000 (7%)] Loss: 0.053628 Train Epoch: 5 [5120/60000 (9%)] Loss: 0.041203 Train Epoch: 5 [5760/60000 (10%)] Loss: 0.062662 Train Epoch: 5 [6400/60000 (11%)] Loss: 0.042457 Train Epoch: 5 [7040/60000 (12%)] Loss: 0.069447 Train Epoch: 5 [7680/60000 (13%)] Loss: 0.263487 Train Epoch: 5 [8320/60000 (14%)] Loss: 0.121907 Train Epoch: 5 [8960/60000 (15%)] Loss: 0.112867 Train Epoch: 5 [9600/60000 (16%)] Loss: 0.033646 Train Epoch: 5 [10240/60000 (17%)] Loss: 0.034200 Train Epoch: 5 [10880/60000 (18%)] Loss: 0.124646 Train Epoch: 5 [11520/60000 (19%)] Loss: 0.091527 Train Epoch: 5 [12160/60000 (20%)] Loss: 0.353837 Train Epoch: 5 [12800/60000 (21%)] Loss: 0.046651 Train Epoch: 5 [13440/60000 (22%)] Loss: 0.055895 Train Epoch: 5 [14080/60000 (23%)] Loss: 0.066822 Train Epoch: 5 [14720/60000 (25%)] Loss: 0.060584 Train Epoch: 5 [15360/60000 (26%)] Loss: 0.077524 Train Epoch: 5 [16000/60000 (27%)] Loss: 0.029719 Train Epoch: 5 [16640/60000 (28%)] Loss: 0.060994 Train Epoch: 5 [17280/60000 (29%)] Loss: 0.051796 Train Epoch: 5 [17920/60000 (30%)] Loss: 0.166119 Train Epoch: 5 [18560/60000 (31%)] Loss: 0.034461 Train Epoch: 5 [19200/60000 (32%)] Loss: 0.165760 Train Epoch: 5 [19840/60000 (33%)] Loss: 0.061641 Train Epoch: 5 [20480/60000 (34%)] Loss: 0.070632 Train Epoch: 5 [21120/60000 (35%)] Loss: 0.170699 Train Epoch: 5 [21760/60000 (36%)] Loss: 0.023626 Train Epoch: 5 [22400/60000 (37%)] Loss: 0.086088 Train Epoch: 5 [23040/60000 (38%)] Loss: 0.033582 Train Epoch: 5 [23680/60000 (39%)] Loss: 0.028206 Train Epoch: 5 [24320/60000 (41%)] Loss: 0.088071 Train Epoch: 5 [24960/60000 (42%)] Loss: 0.115715 Train Epoch: 5 [25600/60000 (43%)] Loss: 0.061839 Train Epoch: 5 [26240/60000 (44%)] Loss: 0.143530 Train Epoch: 5 [26880/60000 (45%)] Loss: 0.056764 Train Epoch: 5 [27520/60000 (46%)] Loss: 0.012387 Train Epoch: 5 [28160/60000 (47%)] Loss: 0.070412 Train Epoch: 5 [28800/60000 (48%)] Loss: 0.017625 Train Epoch: 5 [29440/60000 (49%)] Loss: 0.040521 Train Epoch: 5 [30080/60000 (50%)] Loss: 0.191649 Train Epoch: 5 [30720/60000 (51%)] Loss: 0.052033 Train Epoch: 5 [31360/60000 (52%)] Loss: 0.042508 Train Epoch: 5 [32000/60000 (53%)] Loss: 0.038528 Train Epoch: 5 [32640/60000 (54%)] Loss: 0.122223 Train Epoch: 5 [33280/60000 (55%)] Loss: 0.196624 Train Epoch: 5 [33920/60000 (57%)] Loss: 0.127779 Train Epoch: 5 [34560/60000 (58%)] Loss: 0.031086 Train Epoch: 5 [35200/60000 (59%)] Loss: 0.071768 Train Epoch: 5 [35840/60000 (60%)] Loss: 0.043593 Train Epoch: 5 [36480/60000 (61%)] Loss: 0.377297 Train Epoch: 5 [37120/60000 (62%)] Loss: 0.058385 Train Epoch: 5 [37760/60000 (63%)] Loss: 0.025936 Train Epoch: 5 [38400/60000 (64%)] Loss: 0.030584 Train Epoch: 5 [39040/60000 (65%)] Loss: 0.017796 Train Epoch: 5 [39680/60000 (66%)] Loss: 0.024442 Train Epoch: 5 [40320/60000 (67%)] Loss: 0.028882 Train Epoch: 5 [40960/60000 (68%)] Loss: 0.068706 Train Epoch: 5 [41600/60000 (69%)] Loss: 0.075895 Train Epoch: 5 [42240/60000 (70%)] Loss: 0.124433 Train Epoch: 5 [42880/60000 (71%)] Loss: 0.128258 Train Epoch: 5 [43520/60000 (72%)] Loss: 0.078347 Train Epoch: 5 [44160/60000 (74%)] Loss: 0.029931 Train Epoch: 5 [44800/60000 (75%)] Loss: 0.137046 Train Epoch: 5 [45440/60000 (76%)] Loss: 0.163048 Train Epoch: 5 [46080/60000 (77%)] Loss: 0.025973 Train Epoch: 5 [46720/60000 (78%)] Loss: 0.170867 Train Epoch: 5 [47360/60000 (79%)] Loss: 0.061204 Train Epoch: 5 [48000/60000 (80%)] Loss: 0.157926 Train Epoch: 5 [48640/60000 (81%)] Loss: 0.118524 Train Epoch: 5 [49280/60000 (82%)] Loss: 0.148709 Train Epoch: 5 [49920/60000 (83%)] Loss: 0.109538 Train Epoch: 5 [50560/60000 (84%)] Loss: 0.049127 Train Epoch: 5 [51200/60000 (85%)] Loss: 0.016073 Train Epoch: 5 [51840/60000 (86%)] Loss: 0.054222 Train Epoch: 5 [52480/60000 (87%)] Loss: 0.043101 Train Epoch: 5 [53120/60000 (88%)] Loss: 0.097749 Train Epoch: 5 [53760/60000 (90%)] Loss: 0.082099 Train Epoch: 5 [54400/60000 (91%)] Loss: 0.036863 Train Epoch: 5 [55040/60000 (92%)] Loss: 0.114467 Train Epoch: 5 [55680/60000 (93%)] Loss: 0.049331 Train Epoch: 5 [56320/60000 (94%)] Loss: 0.070385 Train Epoch: 5 [56960/60000 (95%)] Loss: 0.134488 Train Epoch: 5 [57600/60000 (96%)] Loss: 0.036805 Train Epoch: 5 [58240/60000 (97%)] Loss: 0.092324 Train Epoch: 5 [58880/60000 (98%)] Loss: 0.035891 Train Epoch: 5 [59520/60000 (99%)] Loss: 0.125011 Test set: Average loss: 0.0678, Accuracy: 9802/10000 (98%) Train Epoch: 6 [0/60000 (0%)] Loss: 0.056992 Train Epoch: 6 [640/60000 (1%)] Loss: 0.139214 Train Epoch: 6 [1280/60000 (2%)] Loss: 0.047416 Train Epoch: 6 [1920/60000 (3%)] Loss: 0.119811 Train Epoch: 6 [2560/60000 (4%)] Loss: 0.048472 Train Epoch: 6 [3200/60000 (5%)] Loss: 0.163104 Train Epoch: 6 [3840/60000 (6%)] Loss: 0.133608 Train Epoch: 6 [4480/60000 (7%)] Loss: 0.002732 Train Epoch: 6 [5120/60000 (9%)] Loss: 0.106044 Train Epoch: 6 [5760/60000 (10%)] Loss: 0.060719 Train Epoch: 6 [6400/60000 (11%)] Loss: 0.051498 Train Epoch: 6 [7040/60000 (12%)] Loss: 0.117920 Train Epoch: 6 [7680/60000 (13%)] Loss: 0.226335 Train Epoch: 6 [8320/60000 (14%)] Loss: 0.075708 Train Epoch: 6 [8960/60000 (15%)] Loss: 0.017281 Train Epoch: 6 [9600/60000 (16%)] Loss: 0.021267 Train Epoch: 6 [10240/60000 (17%)] Loss: 0.026917 Train Epoch: 6 [10880/60000 (18%)] Loss: 0.083198 Train Epoch: 6 [11520/60000 (19%)] Loss: 0.048965 Train Epoch: 6 [12160/60000 (20%)] Loss: 0.033739 Train Epoch: 6 [12800/60000 (21%)] Loss: 0.065381 Train Epoch: 6 [13440/60000 (22%)] Loss: 0.054494 Train Epoch: 6 [14080/60000 (23%)] Loss: 0.202451 Train Epoch: 6 [14720/60000 (25%)] Loss: 0.077869 Train Epoch: 6 [15360/60000 (26%)] Loss: 0.085073 Train Epoch: 6 [16000/60000 (27%)] Loss: 0.013286 Train Epoch: 6 [16640/60000 (28%)] Loss: 0.058315 Train Epoch: 6 [17280/60000 (29%)] Loss: 0.073047 Train Epoch: 6 [17920/60000 (30%)] Loss: 0.038334 Train Epoch: 6 [18560/60000 (31%)] Loss: 0.054286 Train Epoch: 6 [19200/60000 (32%)] Loss: 0.046039 Train Epoch: 6 [19840/60000 (33%)] Loss: 0.035886 Train Epoch: 6 [20480/60000 (34%)] Loss: 0.085488 Train Epoch: 6 [21120/60000 (35%)] Loss: 0.077075 Train Epoch: 6 [21760/60000 (36%)] Loss: 0.089925 Train Epoch: 6 [22400/60000 (37%)] Loss: 0.150688 Train Epoch: 6 [23040/60000 (38%)] Loss: 0.119949 Train Epoch: 6 [23680/60000 (39%)] Loss: 0.083399 Train Epoch: 6 [24320/60000 (41%)] Loss: 0.060827 Train Epoch: 6 [24960/60000 (42%)] Loss: 0.192299 Train Epoch: 6 [25600/60000 (43%)] Loss: 0.049599 Train Epoch: 6 [26240/60000 (44%)] Loss: 0.037659 Train Epoch: 6 [26880/60000 (45%)] Loss: 0.053850 Train Epoch: 6 [27520/60000 (46%)] Loss: 0.011844 Train Epoch: 6 [28160/60000 (47%)] Loss: 0.030450 Train Epoch: 6 [28800/60000 (48%)] Loss: 0.076021 Train Epoch: 6 [29440/60000 (49%)] Loss: 0.166136 Train Epoch: 6 [30080/60000 (50%)] Loss: 0.030463 Train Epoch: 6 [30720/60000 (51%)] Loss: 0.111804 Train Epoch: 6 [31360/60000 (52%)] Loss: 0.013492 Train Epoch: 6 [32000/60000 (53%)] Loss: 0.058684 Train Epoch: 6 [32640/60000 (54%)] Loss: 0.125379 Train Epoch: 6 [33280/60000 (55%)] Loss: 0.400959 Train Epoch: 6 [33920/60000 (57%)] Loss: 0.161736 Train Epoch: 6 [34560/60000 (58%)] Loss: 0.068050 Train Epoch: 6 [35200/60000 (59%)] Loss: 0.082666 Train Epoch: 6 [35840/60000 (60%)] Loss: 0.039739 Train Epoch: 6 [36480/60000 (61%)] Loss: 0.124332 Train Epoch: 6 [37120/60000 (62%)] Loss: 0.069341 Train Epoch: 6 [37760/60000 (63%)] Loss: 0.110575 Train Epoch: 6 [38400/60000 (64%)] Loss: 0.019776 Train Epoch: 6 [39040/60000 (65%)] Loss: 0.125340 Train Epoch: 6 [39680/60000 (66%)] Loss: 0.289195 Train Epoch: 6 [40320/60000 (67%)] Loss: 0.026776 Train Epoch: 6 [40960/60000 (68%)] Loss: 0.123123 Train Epoch: 6 [41600/60000 (69%)] Loss: 0.095079 Train Epoch: 6 [42240/60000 (70%)] Loss: 0.204592 Train Epoch: 6 [42880/60000 (71%)] Loss: 0.062658 Train Epoch: 6 [43520/60000 (72%)] Loss: 0.062846 Train Epoch: 6 [44160/60000 (74%)] Loss: 0.035293 Train Epoch: 6 [44800/60000 (75%)] Loss: 0.022750 Train Epoch: 6 [45440/60000 (76%)] Loss: 0.029933 Train Epoch: 6 [46080/60000 (77%)] Loss: 0.121406 Train Epoch: 6 [46720/60000 (78%)] Loss: 0.158908 Train Epoch: 6 [47360/60000 (79%)] Loss: 0.053591 Train Epoch: 6 [48000/60000 (80%)] Loss: 0.057661 Train Epoch: 6 [48640/60000 (81%)] Loss: 0.055967 Train Epoch: 6 [49280/60000 (82%)] Loss: 0.021558 Train Epoch: 6 [49920/60000 (83%)] Loss: 0.132524 Train Epoch: 6 [50560/60000 (84%)] Loss: 0.059439 Train Epoch: 6 [51200/60000 (85%)] Loss: 0.065816 Train Epoch: 6 [51840/60000 (86%)] Loss: 0.069396 Train Epoch: 6 [52480/60000 (87%)] Loss: 0.096557 Train Epoch: 6 [53120/60000 (88%)] Loss: 0.020840 Train Epoch: 6 [53760/60000 (90%)] Loss: 0.087607 Train Epoch: 6 [54400/60000 (91%)] Loss: 0.223364 Train Epoch: 6 [55040/60000 (92%)] Loss: 0.036307 Train Epoch: 6 [55680/60000 (93%)] Loss: 0.037978 Train Epoch: 6 [56320/60000 (94%)] Loss: 0.088568 Train Epoch: 6 [56960/60000 (95%)] Loss: 0.015448 Train Epoch: 6 [57600/60000 (96%)] Loss: 0.043836 Train Epoch: 6 [58240/60000 (97%)] Loss: 0.152100 Train Epoch: 6 [58880/60000 (98%)] Loss: 0.046384 Train Epoch: 6 [59520/60000 (99%)] Loss: 0.121224 Test set: Average loss: 0.0627, Accuracy: 9794/10000 (98%) Train Epoch: 7 [0/60000 (0%)] Loss: 0.038668 Train Epoch: 7 [640/60000 (1%)] Loss: 0.152985 Train Epoch: 7 [1280/60000 (2%)] Loss: 0.067919 Train Epoch: 7 [1920/60000 (3%)] Loss: 0.015419 Train Epoch: 7 [2560/60000 (4%)] Loss: 0.066578 Train Epoch: 7 [3200/60000 (5%)] Loss: 0.100658 Train Epoch: 7 [3840/60000 (6%)] Loss: 0.005591 Train Epoch: 7 [4480/60000 (7%)] Loss: 0.016872 Train Epoch: 7 [5120/60000 (9%)] Loss: 0.099707 Train Epoch: 7 [5760/60000 (10%)] Loss: 0.026898 Train Epoch: 7 [6400/60000 (11%)] Loss: 0.087944 Train Epoch: 7 [7040/60000 (12%)] Loss: 0.058212 Train Epoch: 7 [7680/60000 (13%)] Loss: 0.122954 Train Epoch: 7 [8320/60000 (14%)] Loss: 0.092256 Train Epoch: 7 [8960/60000 (15%)] Loss: 0.026217 Train Epoch: 7 [9600/60000 (16%)] Loss: 0.064904 Train Epoch: 7 [10240/60000 (17%)] Loss: 0.031789 Train Epoch: 7 [10880/60000 (18%)] Loss: 0.120419 Train Epoch: 7 [11520/60000 (19%)] Loss: 0.012021 Train Epoch: 7 [12160/60000 (20%)] Loss: 0.054026 Train Epoch: 7 [12800/60000 (21%)] Loss: 0.026579 Train Epoch: 7 [13440/60000 (22%)] Loss: 0.101119 Train Epoch: 7 [14080/60000 (23%)] Loss: 0.042643 Train Epoch: 7 [14720/60000 (25%)] Loss: 0.031907 Train Epoch: 7 [15360/60000 (26%)] Loss: 0.009277 Train Epoch: 7 [16000/60000 (27%)] Loss: 0.054256 Train Epoch: 7 [16640/60000 (28%)] Loss: 0.017699 Train Epoch: 7 [17280/60000 (29%)] Loss: 0.009340 Train Epoch: 7 [17920/60000 (30%)] Loss: 0.035420 Train Epoch: 7 [18560/60000 (31%)] Loss: 0.082220 Train Epoch: 7 [19200/60000 (32%)] Loss: 0.016140 Train Epoch: 7 [19840/60000 (33%)] Loss: 0.199725 Train Epoch: 7 [20480/60000 (34%)] Loss: 0.142392 Train Epoch: 7 [21120/60000 (35%)] Loss: 0.106283 Train Epoch: 7 [21760/60000 (36%)] Loss: 0.013798 Train Epoch: 7 [22400/60000 (37%)] Loss: 0.053685 Train Epoch: 7 [23040/60000 (38%)] Loss: 0.036926 Train Epoch: 7 [23680/60000 (39%)] Loss: 0.097976 Train Epoch: 7 [24320/60000 (41%)] Loss: 0.061216 Train Epoch: 7 [24960/60000 (42%)] Loss: 0.043279 Train Epoch: 7 [25600/60000 (43%)] Loss: 0.024839 Train Epoch: 7 [26240/60000 (44%)] Loss: 0.141898 Train Epoch: 7 [26880/60000 (45%)] Loss: 0.017919 Train Epoch: 7 [27520/60000 (46%)] Loss: 0.016729 Train Epoch: 7 [28160/60000 (47%)] Loss: 0.104839 Train Epoch: 7 [28800/60000 (48%)] Loss: 0.044670 Train Epoch: 7 [29440/60000 (49%)] Loss: 0.057063 Train Epoch: 7 [30080/60000 (50%)] Loss: 0.118510 Train Epoch: 7 [30720/60000 (51%)] Loss: 0.085390 Train Epoch: 7 [31360/60000 (52%)] Loss: 0.027877 Train Epoch: 7 [32000/60000 (53%)] Loss: 0.029926 Train Epoch: 7 [32640/60000 (54%)] Loss: 0.020083 Train Epoch: 7 [33280/60000 (55%)] Loss: 0.185776 Train Epoch: 7 [33920/60000 (57%)] Loss: 0.036906 Train Epoch: 7 [34560/60000 (58%)] Loss: 0.054783 Train Epoch: 7 [35200/60000 (59%)] Loss: 0.047408 Train Epoch: 7 [35840/60000 (60%)] Loss: 0.161220 Train Epoch: 7 [36480/60000 (61%)] Loss: 0.059554 Train Epoch: 7 [37120/60000 (62%)] Loss: 0.178432 Train Epoch: 7 [37760/60000 (63%)] Loss: 0.042241 Train Epoch: 7 [38400/60000 (64%)] Loss: 0.091979 Train Epoch: 7 [39040/60000 (65%)] Loss: 0.052732 Train Epoch: 7 [39680/60000 (66%)] Loss: 0.024201 Train Epoch: 7 [40320/60000 (67%)] Loss: 0.092958 Train Epoch: 7 [40960/60000 (68%)] Loss: 0.050351 Train Epoch: 7 [41600/60000 (69%)] Loss: 0.089817 Train Epoch: 7 [42240/60000 (70%)] Loss: 0.132323 Train Epoch: 7 [42880/60000 (71%)] Loss: 0.008266 Train Epoch: 7 [43520/60000 (72%)] Loss: 0.032016 Train Epoch: 7 [44160/60000 (74%)] Loss: 0.217488 Train Epoch: 7 [44800/60000 (75%)] Loss: 0.039236 Train Epoch: 7 [45440/60000 (76%)] Loss: 0.040128 Train Epoch: 7 [46080/60000 (77%)] Loss: 0.075809 Train Epoch: 7 [46720/60000 (78%)] Loss: 0.054285 Train Epoch: 7 [47360/60000 (79%)] Loss: 0.040743 Train Epoch: 7 [48000/60000 (80%)] Loss: 0.045380 Train Epoch: 7 [48640/60000 (81%)] Loss: 0.045553 Train Epoch: 7 [49280/60000 (82%)] Loss: 0.066226 Train Epoch: 7 [49920/60000 (83%)] Loss: 0.122073 Train Epoch: 7 [50560/60000 (84%)] Loss: 0.056059 Train Epoch: 7 [51200/60000 (85%)] Loss: 0.045100 Train Epoch: 7 [51840/60000 (86%)] Loss: 0.029869 Train Epoch: 7 [52480/60000 (87%)] Loss: 0.041358 Train Epoch: 7 [53120/60000 (88%)] Loss: 0.024694 Train Epoch: 7 [53760/60000 (90%)] Loss: 0.047613 Train Epoch: 7 [54400/60000 (91%)] Loss: 0.053296 Train Epoch: 7 [55040/60000 (92%)] Loss: 0.057106 Train Epoch: 7 [55680/60000 (93%)] Loss: 0.064469 Train Epoch: 7 [56320/60000 (94%)] Loss: 0.008784 Train Epoch: 7 [56960/60000 (95%)] Loss: 0.020461 Train Epoch: 7 [57600/60000 (96%)] Loss: 0.083198 Train Epoch: 7 [58240/60000 (97%)] Loss: 0.031770 Train Epoch: 7 [58880/60000 (98%)] Loss: 0.028213 Train Epoch: 7 [59520/60000 (99%)] Loss: 0.095529 Test set: Average loss: 0.0580, Accuracy: 9822/10000 (98%) Train Epoch: 8 [0/60000 (0%)] Loss: 0.095277 Train Epoch: 8 [640/60000 (1%)] Loss: 0.143193 Train Epoch: 8 [1280/60000 (2%)] Loss: 0.028024 Train Epoch: 8 [1920/60000 (3%)] Loss: 0.014284 Train Epoch: 8 [2560/60000 (4%)] Loss: 0.024069 Train Epoch: 8 [3200/60000 (5%)] Loss: 0.044241 Train Epoch: 8 [3840/60000 (6%)] Loss: 0.070332 Train Epoch: 8 [4480/60000 (7%)] Loss: 0.055925 Train Epoch: 8 [5120/60000 (9%)] Loss: 0.093262 Train Epoch: 8 [5760/60000 (10%)] Loss: 0.034249 Train Epoch: 8 [6400/60000 (11%)] Loss: 0.055211 Train Epoch: 8 [7040/60000 (12%)] Loss: 0.022661 Train Epoch: 8 [7680/60000 (13%)] Loss: 0.141150 Train Epoch: 8 [8320/60000 (14%)] Loss: 0.100695 Train Epoch: 8 [8960/60000 (15%)] Loss: 0.027464 Train Epoch: 8 [9600/60000 (16%)] Loss: 0.022342 Train Epoch: 8 [10240/60000 (17%)] Loss: 0.054020 Train Epoch: 8 [10880/60000 (18%)] Loss: 0.205738 Train Epoch: 8 [11520/60000 (19%)] Loss: 0.008106 Train Epoch: 8 [12160/60000 (20%)] Loss: 0.040244 Train Epoch: 8 [12800/60000 (21%)] Loss: 0.138055 Train Epoch: 8 [13440/60000 (22%)] Loss: 0.014804 Train Epoch: 8 [14080/60000 (23%)] Loss: 0.025389 Train Epoch: 8 [14720/60000 (25%)] Loss: 0.023334 Train Epoch: 8 [15360/60000 (26%)] Loss: 0.210289 Train Epoch: 8 [16000/60000 (27%)] Loss: 0.023116 Train Epoch: 8 [16640/60000 (28%)] Loss: 0.031807 Train Epoch: 8 [17280/60000 (29%)] Loss: 0.059268 Train Epoch: 8 [17920/60000 (30%)] Loss: 0.005770 Train Epoch: 8 [18560/60000 (31%)] Loss: 0.046716 Train Epoch: 8 [19200/60000 (32%)] Loss: 0.012603 Train Epoch: 8 [19840/60000 (33%)] Loss: 0.140218 Train Epoch: 8 [20480/60000 (34%)] Loss: 0.020282 Train Epoch: 8 [21120/60000 (35%)] Loss: 0.039421 Train Epoch: 8 [21760/60000 (36%)] Loss: 0.055249 Train Epoch: 8 [22400/60000 (37%)] Loss: 0.211906 Train Epoch: 8 [23040/60000 (38%)] Loss: 0.017459 Train Epoch: 8 [23680/60000 (39%)] Loss: 0.066078 Train Epoch: 8 [24320/60000 (41%)] Loss: 0.046964 Train Epoch: 8 [24960/60000 (42%)] Loss: 0.053014 Train Epoch: 8 [25600/60000 (43%)] Loss: 0.085308 Train Epoch: 8 [26240/60000 (44%)] Loss: 0.015619 Train Epoch: 8 [26880/60000 (45%)] Loss: 0.022641 Train Epoch: 8 [27520/60000 (46%)] Loss: 0.010636 Train Epoch: 8 [28160/60000 (47%)] Loss: 0.030925 Train Epoch: 8 [28800/60000 (48%)] Loss: 0.041090 Train Epoch: 8 [29440/60000 (49%)] Loss: 0.184022 Train Epoch: 8 [30080/60000 (50%)] Loss: 0.033844 Train Epoch: 8 [30720/60000 (51%)] Loss: 0.045638 Train Epoch: 8 [31360/60000 (52%)] Loss: 0.146449 Train Epoch: 8 [32000/60000 (53%)] Loss: 0.037750 Train Epoch: 8 [32640/60000 (54%)] Loss: 0.037086 Train Epoch: 8 [33280/60000 (55%)] Loss: 0.156055 Train Epoch: 8 [33920/60000 (57%)] Loss: 0.245971 Train Epoch: 8 [34560/60000 (58%)] Loss: 0.034121 Train Epoch: 8 [35200/60000 (59%)] Loss: 0.055762 Train Epoch: 8 [35840/60000 (60%)] Loss: 0.032042 Train Epoch: 8 [36480/60000 (61%)] Loss: 0.073726 Train Epoch: 8 [37120/60000 (62%)] Loss: 0.062818 Train Epoch: 8 [37760/60000 (63%)] Loss: 0.110426 Train Epoch: 8 [38400/60000 (64%)] Loss: 0.118748 Train Epoch: 8 [39040/60000 (65%)] Loss: 0.056931 Train Epoch: 8 [39680/60000 (66%)] Loss: 0.079196 Train Epoch: 8 [40320/60000 (67%)] Loss: 0.044671 Train Epoch: 8 [40960/60000 (68%)] Loss: 0.074844 Train Epoch: 8 [41600/60000 (69%)] Loss: 0.134735 Train Epoch: 8 [42240/60000 (70%)] Loss: 0.041291 Train Epoch: 8 [42880/60000 (71%)] Loss: 0.072597 Train Epoch: 8 [43520/60000 (72%)] Loss: 0.081559 Train Epoch: 8 [44160/60000 (74%)] Loss: 0.045724 Train Epoch: 8 [44800/60000 (75%)] Loss: 0.062839 Train Epoch: 8 [45440/60000 (76%)] Loss: 0.076726 Train Epoch: 8 [46080/60000 (77%)] Loss: 0.032096 Train Epoch: 8 [46720/60000 (78%)] Loss: 0.143978 Train Epoch: 8 [47360/60000 (79%)] Loss: 0.012995 Train Epoch: 8 [48000/60000 (80%)] Loss: 0.013371 Train Epoch: 8 [48640/60000 (81%)] Loss: 0.103640 Train Epoch: 8 [49280/60000 (82%)] Loss: 0.031259 Train Epoch: 8 [49920/60000 (83%)] Loss: 0.048746 Train Epoch: 8 [50560/60000 (84%)] Loss: 0.063274 Train Epoch: 8 [51200/60000 (85%)] Loss: 0.071457 Train Epoch: 8 [51840/60000 (86%)] Loss: 0.044408 Train Epoch: 8 [52480/60000 (87%)] Loss: 0.194396 Train Epoch: 8 [53120/60000 (88%)] Loss: 0.176485 Train Epoch: 8 [53760/60000 (90%)] Loss: 0.047335 Train Epoch: 8 [54400/60000 (91%)] Loss: 0.118688 Train Epoch: 8 [55040/60000 (92%)] Loss: 0.045645 Train Epoch: 8 [55680/60000 (93%)] Loss: 0.067245 Train Epoch: 8 [56320/60000 (94%)] Loss: 0.030975 Train Epoch: 8 [56960/60000 (95%)] Loss: 0.049449 Train Epoch: 8 [57600/60000 (96%)] Loss: 0.022767 Train Epoch: 8 [58240/60000 (97%)] Loss: 0.014989 Train Epoch: 8 [58880/60000 (98%)] Loss: 0.019494 Train Epoch: 8 [59520/60000 (99%)] Loss: 0.046725 Test set: Average loss: 0.0554, Accuracy: 9816/10000 (98%) Train Epoch: 9 [0/60000 (0%)] Loss: 0.157581 Train Epoch: 9 [640/60000 (1%)] Loss: 0.014102 Train Epoch: 9 [1280/60000 (2%)] Loss: 0.050544 Train Epoch: 9 [1920/60000 (3%)] Loss: 0.144397 Train Epoch: 9 [2560/60000 (4%)] Loss: 0.050650 Train Epoch: 9 [3200/60000 (5%)] Loss: 0.015721 Train Epoch: 9 [3840/60000 (6%)] Loss: 0.063486 Train Epoch: 9 [4480/60000 (7%)] Loss: 0.048654 Train Epoch: 9 [5120/60000 (9%)] Loss: 0.022528 Train Epoch: 9 [5760/60000 (10%)] Loss: 0.031864 Train Epoch: 9 [6400/60000 (11%)] Loss: 0.064015 Train Epoch: 9 [7040/60000 (12%)] Loss: 0.058589 Train Epoch: 9 [7680/60000 (13%)] Loss: 0.072318 Train Epoch: 9 [8320/60000 (14%)] Loss: 0.154009 Train Epoch: 9 [8960/60000 (15%)] Loss: 0.035568 Train Epoch: 9 [9600/60000 (16%)] Loss: 0.037959 Train Epoch: 9 [10240/60000 (17%)] Loss: 0.061792 Train Epoch: 9 [10880/60000 (18%)] Loss: 0.154225 Train Epoch: 9 [11520/60000 (19%)] Loss: 0.042054 Train Epoch: 9 [12160/60000 (20%)] Loss: 0.047962 Train Epoch: 9 [12800/60000 (21%)] Loss: 0.011696 Train Epoch: 9 [13440/60000 (22%)] Loss: 0.046374 Train Epoch: 9 [14080/60000 (23%)] Loss: 0.017912 Train Epoch: 9 [14720/60000 (25%)] Loss: 0.068677 Train Epoch: 9 [15360/60000 (26%)] Loss: 0.091715 Train Epoch: 9 [16000/60000 (27%)] Loss: 0.079036 Train Epoch: 9 [16640/60000 (28%)] Loss: 0.081812 Train Epoch: 9 [17280/60000 (29%)] Loss: 0.012159 Train Epoch: 9 [17920/60000 (30%)] Loss: 0.030305 Train Epoch: 9 [18560/60000 (31%)] Loss: 0.018032 Train Epoch: 9 [19200/60000 (32%)] Loss: 0.079029 Train Epoch: 9 [19840/60000 (33%)] Loss: 0.005227 Train Epoch: 9 [20480/60000 (34%)] Loss: 0.088407 Train Epoch: 9 [21120/60000 (35%)] Loss: 0.013704 Train Epoch: 9 [21760/60000 (36%)] Loss: 0.162432 Train Epoch: 9 [22400/60000 (37%)] Loss: 0.118379 Train Epoch: 9 [23040/60000 (38%)] Loss: 0.037038 Train Epoch: 9 [23680/60000 (39%)] Loss: 0.033017 Train Epoch: 9 [24320/60000 (41%)] Loss: 0.045480 Train Epoch: 9 [24960/60000 (42%)] Loss: 0.023685 Train Epoch: 9 [25600/60000 (43%)] Loss: 0.016987 Train Epoch: 9 [26240/60000 (44%)] Loss: 0.137735 Train Epoch: 9 [26880/60000 (45%)] Loss: 0.006446 Train Epoch: 9 [27520/60000 (46%)] Loss: 0.127449 Train Epoch: 9 [28160/60000 (47%)] Loss: 0.043093 Train Epoch: 9 [28800/60000 (48%)] Loss: 0.047350 Train Epoch: 9 [29440/60000 (49%)] Loss: 0.006704 Train Epoch: 9 [30080/60000 (50%)] Loss: 0.083558 Train Epoch: 9 [30720/60000 (51%)] Loss: 0.072605 Train Epoch: 9 [31360/60000 (52%)] Loss: 0.040057 Train Epoch: 9 [32000/60000 (53%)] Loss: 0.064798 Train Epoch: 9 [32640/60000 (54%)] Loss: 0.084828 Train Epoch: 9 [33280/60000 (55%)] Loss: 0.066748 Train Epoch: 9 [33920/60000 (57%)] Loss: 0.023121 Train Epoch: 9 [34560/60000 (58%)] Loss: 0.041183 Train Epoch: 9 [35200/60000 (59%)] Loss: 0.057904 Train Epoch: 9 [35840/60000 (60%)] Loss: 0.094694 Train Epoch: 9 [36480/60000 (61%)] Loss: 0.057253 Train Epoch: 9 [37120/60000 (62%)] Loss: 0.029024 Train Epoch: 9 [37760/60000 (63%)] Loss: 0.049026 Train Epoch: 9 [38400/60000 (64%)] Loss: 0.031180 Train Epoch: 9 [39040/60000 (65%)] Loss: 0.018087 Train Epoch: 9 [39680/60000 (66%)] Loss: 0.121827 Train Epoch: 9 [40320/60000 (67%)] Loss: 0.026022 Train Epoch: 9 [40960/60000 (68%)] Loss: 0.094626 Train Epoch: 9 [41600/60000 (69%)] Loss: 0.060430 Train Epoch: 9 [42240/60000 (70%)] Loss: 0.027267 Train Epoch: 9 [42880/60000 (71%)] Loss: 0.105337 Train Epoch: 9 [43520/60000 (72%)] Loss: 0.029487 Train Epoch: 9 [44160/60000 (74%)] Loss: 0.029931 Train Epoch: 9 [44800/60000 (75%)] Loss: 0.064974 Train Epoch: 9 [45440/60000 (76%)] Loss: 0.090586 Train Epoch: 9 [46080/60000 (77%)] Loss: 0.092096 Train Epoch: 9 [46720/60000 (78%)] Loss: 0.010928 Train Epoch: 9 [47360/60000 (79%)] Loss: 0.056327 Train Epoch: 9 [48000/60000 (80%)] Loss: 0.031470 Train Epoch: 9 [48640/60000 (81%)] Loss: 0.062591 Train Epoch: 9 [49280/60000 (82%)] Loss: 0.079878 Train Epoch: 9 [49920/60000 (83%)] Loss: 0.025575 Train Epoch: 9 [50560/60000 (84%)] Loss: 0.016678 Train Epoch: 9 [51200/60000 (85%)] Loss: 0.036606 Train Epoch: 9 [51840/60000 (86%)] Loss: 0.009055 Train Epoch: 9 [52480/60000 (87%)] Loss: 0.077593 Train Epoch: 9 [53120/60000 (88%)] Loss: 0.049766 Train Epoch: 9 [53760/60000 (90%)] Loss: 0.029348 Train Epoch: 9 [54400/60000 (91%)] Loss: 0.026008 Train Epoch: 9 [55040/60000 (92%)] Loss: 0.007919 Train Epoch: 9 [55680/60000 (93%)] Loss: 0.065004 Train Epoch: 9 [56320/60000 (94%)] Loss: 0.020004 Train Epoch: 9 [56960/60000 (95%)] Loss: 0.023373 Train Epoch: 9 [57600/60000 (96%)] Loss: 0.013297 Train Epoch: 9 [58240/60000 (97%)] Loss: 0.091797 Train Epoch: 9 [58880/60000 (98%)] Loss: 0.027091 Train Epoch: 9 [59520/60000 (99%)] Loss: 0.082391 Test set: Average loss: 0.0504, Accuracy: 9839/10000 (98%)
Finally, we copy and paste the last 5 lines of the testing result:
*Test set: Average loss: 0.0484, Accuracy: 9849/10000 (98%)
NOTE: The above result changes every time, but fianl Accuracy is always roughly the same.