mirror of
https://github.com/hpcaitech/ColossalAI.git
synced 2025-10-22 15:26:57 +00:00
* integrated parallel layers for ease of building models * integrated 2.5d layers * cleaned codes and unit tests * added log metric by step hook; updated imagenet benchmark; fixed some bugs * reworked initialization; cleaned codes Co-authored-by: BoxiangW <45734921+BoxiangW@users.noreply.github.com>
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
|