mirror of
https://github.com/hpcaitech/ColossalAI.git
synced 2025-06-19 04:02:17 +00:00
* [legacy] move communication to legacy (#4640) * [legacy] refactor logger and clean up legacy codes (#4654) * [legacy] make logger independent to gpc * [legacy] make optim independent to registry * [legacy] move test engine to legacy * [legacy] move nn to legacy (#4656) * [legacy] move nn to legacy * [checkpointio] fix save hf config * [test] remove useledd rpc pp test * [legacy] fix nn init * [example] skip tutorial hybriad parallel example * [devops] test doc check * [devops] test doc check
8 lines
148 B
Python
8 lines
148 B
Python
import torch
|
|
|
|
|
|
def calc_acc(logits, targets):
|
|
preds = torch.argmax(logits, dim=-1)
|
|
correct = torch.sum(targets == preds)
|
|
return correct
|