def METHOD_NAME(label_words_logits, atype="mean", ndim=2):
    """
    Aggregate embeddings when multiple words are mapped to one label.
    Args:
        label_words_logits (paddle.Tensor):
            The logits of words which could be mapped to labels.
        atype (str):
            The aggregation strategy, including mean and first.
        ndim (str):
            The aggregated embeddings' number of dimensions.
    """
    if label_words_logits.ndim > ndim:
        if atype == "mean":
            return label_words_logits.mean(axis=-1)
        elif atype == "max":
            return label_words_logits.max(axis=-1)
        elif atype == "first":
            return label_words_logits[..., 0, :]
        else:
            raise ValueError("Unsupported aggreate type {}".format(atype))
    return label_words_logits