mirror of
https://github.com/hpcaitech/ColossalAI.git
synced 2025-06-28 16:28:10 +00:00
8 lines
155 B
Python
8 lines
155 B
Python
import torch
|
|
|
|
|
|
def calc_acc(logits, targets):
|
|
preds = torch.argmax(logits, dim=-1)
|
|
correct = torch.sum(targets == preds)
|
|
return correct
|