def METHOD_NAME(logging_outputs) -> None:
    """Aggregate logging outputs from data parallel training."""
    loss_sum = utils.item(sum(log.get("loss", 0) for log in logging_outputs))
    ntokens = utils.item(sum(log.get("ntokens", 0) for log in logging_outputs))
    nsentences = utils.item(
        sum(log.get("nsentences", 0) for log in logging_outputs)
    )
    sample_size = utils.item(
        sum(log.get("sample_size", 0) for log in logging_outputs)
    )
    metrics.log_scalar("loss", loss_sum / sample_size, sample_size, round=3)
    metrics.log_scalar("ntokens", ntokens)
    metrics.log_scalar("nsentences", nsentences)
    builtin_keys = {
        "loss",
        "ntokens",
        "nsentences",
        "sample_size",
        "_world_size",
    }
    world_size = utils.item(
        sum(log.get("_world_size", 0) for log in logging_outputs)
    )
    for k in logging_outputs[0]:
        if k not in builtin_keys:
            val = sum(log.get(k, 0) for log in logging_outputs)
            if k.startswith("loss_"):
                metrics.log_scalar(k, val / sample_size, sample_size, round=3)
            else:
                metrics.log_scalar(k, val / world_size, round=3)