Skip to content

Commit 33d3a90

Browse files
author
Will Feng
committed
make cifar10_tutorial.py even faster
1 parent c587fcf commit 33d3a90

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

beginner_source/blitz/cifar10_tutorial.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ def forward(self, x):
178178
print('[%d, %5d] loss: %.3f' %
179179
(epoch + 1, i + 1, running_loss / 2000))
180180
running_loss = 0.0
181+
break
181182

182183
print('Finished Training')
183184

@@ -230,6 +231,7 @@ def forward(self, x):
230231
_, predicted = torch.max(outputs.data, 1)
231232
total += labels.size(0)
232233
correct += (predicted == labels).sum().item()
234+
break
233235

234236
print('Accuracy of the network on the 10000 test images: %d %%' % (
235237
100 * correct / total))
@@ -254,6 +256,7 @@ def forward(self, x):
254256
label = labels[i]
255257
class_correct[label] += c[i].item()
256258
class_total[label] += 1
259+
break
257260

258261

259262
for i in range(10):
@@ -336,4 +339,6 @@ def forward(self, x):
336339

337340
# %%%%%%INVISIBLE_CODE_BLOCK%%%%%%
338341
del dataiter
342+
del trainloader
343+
del testloader
339344
# %%%%%%INVISIBLE_CODE_BLOCK%%%%%%

0 commit comments

Comments
 (0)