mirror of https://github.com/hpcaitech/ColossalAI
7 lines
153 B
Python
7 lines
153 B
Python
|
import torch
|
||
|
|
||
|
def calc_acc(logits, targets):
|
||
|
preds = torch.argmax(logits, dim=-1)
|
||
|
correct = torch.sum(targets == preds)
|
||
|
return correct
|