def METHOD_NAME(self, scores, labels, valid_mode, if_top5=True):
    if if_top5:
        top1 = paddle.metric.accuracy(input=scores, label=labels, k=1)
        top5 = paddle.metric.accuracy(input=scores, label=labels, k=5)
        _, world_size = get_dist_info()
        #NOTE(shipping): deal with multi cards validate
        if world_size > 1 and valid_mode:  #reduce sum when valid
            paddle.distributed.all_reduce(
                top1, op=paddle.distributed.ReduceOp.SUM)
            top1 = top1 / world_size
            paddle.distributed.all_reduce(
                top5, op=paddle.distributed.ReduceOp.SUM)
            top5 = top5 / world_size
        return top1, top5
    else:
        top1 = paddle.metric.accuracy(input=scores, label=labels, k=1)
        _, world_size = get_dist_info()
        #NOTE(shipping): deal with multi cards validate
        if world_size > 1 and valid_mode:  #reduce sum when valid
            paddle.distributed.all_reduce(
                top1, op=paddle.distributed.ReduceOp.SUM)
            top1 = top1 / world_size
        return top1