MCPcopy Create free account
hub / github.com/OUCMachineLearning/OUCML / test

Function test

Regularization/Cutout-master/train.py:168–185  ·  view source on GitHub ↗
(loader)

Source from the content-addressed store, hash-verified

166
167
168def test(loader):
169 cnn.eval() # Change model to 'eval' mode (BN uses moving mean/var).
170 correct = 0.
171 total = 0.
172 for images, labels in loader:
173 images = images.cuda()
174 labels = labels.cuda()
175
176 with torch.no_grad():
177 pred = cnn(images)
178
179 pred = torch.max(pred.data, 1)[1]
180 total += labels.size(0)
181 correct += (pred == labels).sum().item()
182
183 val_acc = correct / total
184 cnn.train()
185 return val_acc
186
187
188for epoch in range(args.epochs):

Callers 1

train.pyFile · 0.85

Calls 1

trainMethod · 0.45

Tested by

no test coverage detected