    def reduce_metrics(self, logging_outputs, criterion):
        super().reduce_metrics(logging_outputs, criterion)

        zero = torch.scalar_tensor(0.0)
        correct, total = 0, 0
        for log in logging_outputs:
            correct += log.get("_correct", zero)
            total += log.get("_total", zero)
        metrics.log_scalar("_correct", correct)
        metrics.log_scalar("_total", total)

        if total > 0:
            def _fn_accuracy(meters):
                if meters["_total"].sum > 0:
                    return utils.item(meters["_correct"].sum / meters["_total"].sum)
                return float("nan")

            metrics.log_derived("accuracy", _fn_accuracy)
        """
        prec_sum, recall_sum, f1_sum, acc_sum, eer_sum = 0.0, 0.0, 0.0, 0.0, 0.0
        for log in logging_outputs:
            prec_sum += log.get("_precision", zero).item()
            recall_sum += log.get("_recall", zero).item()
            f1_sum += log.get("_f1", zero).item()
            acc_sum += log.get("_accuracy", zero).item()
            eer_sum += log.get("_eer", zero).item()

        metrics.log_scalar("avg_precision", prec_sum / len(logging_outputs))
        metrics.log_scalar("avg_recall", recall_sum / len(logging_outputs))
        metrics.log_scalar("avg_f1", f1_sum / len(logging_outputs))
        metrics.log_scalar("avg_accuracy", acc_sum / len(logging_outputs))
        metrics.log_scalar("avg_eer", eer_sum / len(logging_outputs))
        """
prec_sum, recall_sum, f1_sum, acc_sum, eer_sum = 0.0, 0.0, 0.0, 0.0, 0.0
for log in logging_outputs:
prec_sum += log.get("_precision", zero).item()
recall_sum += log.get("_recall", zero).item()
f1_sum += log.get("_f1", zero).item()
acc_sum += log.get("_accuracy", zero).item()
eer_sum += log.get("_eer", zero).item()

metrics.log_scalar("avg_precision", prec_sum / len(logging_outputs))
metrics.log_scalar("avg_recall", recall_sum / len(logging_outputs))
metrics.log_scalar("avg_f1", f1_sum / len(logging_outputs))
metrics.log_scalar("avg_accuracy", acc_sum / len(logging_outputs))
metrics.log_scalar("avg_eer", eer_sum / len(logging_outputs))
fairseq/tasks/audio_classification.py