MCPcopy
hub / github.com/appvision-ai/fast-bert / accuracy

Function accuracy

fast_bert/metrics.py:23–26  ·  view source on GitHub ↗
(y_pred: Tensor, y_true: Tensor, **kwargs)

Source from the content-addressed store, hash-verified

21
22
23def accuracy(y_pred: Tensor, y_true: Tensor, **kwargs):
24 y_pred = y_pred.cpu()
25 outputs = np.argmax(y_pred, axis=1)
26 return np.mean(outputs.numpy() == y_true.detach().cpu().numpy())
27
28
29def accuracy_multilabel(y_pred: Tensor, y_true: Tensor, sigmoid: bool = True, **kwargs):

Callers

nothing calls this directly

Calls 1

detachMethod · 0.45

Tested by

no test coverage detected