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

Function accuracy

AutoML/darts-master/cnn/utils.py:25–37  ·  view source on GitHub ↗
(output, target, topk=(1,))

Source from the content-addressed store, hash-verified

23
24
25def accuracy(output, target, topk=(1,)):
26 maxk = max(topk)
27 batch_size = target.size(0)
28
29 _, pred = output.topk(maxk, 1, True, True)
30 pred = pred.t()
31 correct = pred.eq(target.view(1, -1).expand_as(pred))
32
33 res = []
34 for k in topk:
35 correct_k = correct[:k].view(-1).float().sum(0)
36 res.append(correct_k.mul_(100.0/batch_size))
37 return res
38
39
40class Cutout(object):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected