提交 480375fb 编写于 作者: M Megvii Engine Team

feat(mge): rename accuracy -> topk_accuracy

GitOrigin-RevId: b6ae007231e6bcb93918b6bdfc6165a67f5b1efc
上级 5b2f0129
......@@ -13,7 +13,7 @@ from .math import *
from .nn import *
from .quantized import conv_bias_activation
from .tensor import *
from .utils import accuracy, copy
from .utils import *
from . import distributed # isort:skip
......
......@@ -18,8 +18,13 @@ from ..core.tensor.core import apply
from .math import topk as _topk
from .tensor import broadcast_to, transpose
__all__ = [
"topk_accuracy",
"copy",
]
def accuracy(
def topk_accuracy(
logits: Tensor, target: Tensor, topk: Union[int, Iterable[int]] = 1
) -> Union[Tensor, Iterable[Tensor]]:
r"""
......@@ -41,7 +46,7 @@ def accuracy(
logits = tensor(np.arange(80, dtype=np.int32).reshape(8,10))
target = tensor(np.arange(8, dtype=np.int32))
top1, top5 = F.accuracy(logits, target, (1, 5))
top1, top5 = F.topk_accuracy(logits, target, (1, 5))
print(top1.numpy(), top5.numpy())
Outputs:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册