def fuse_key_value(key, value, key_padding_mask, value_padding_mask, fusing):
    """
    Fuse key representation and value representation

    Args:
        key:
            :math:`(K, N, E)` where N is the batch size, K is the key number, E is the embedding size.
        value:
            :math:`(L, K, N, E)` where L is the value length, N is the batch size, K is the key number,
            E is the embedding size.
        key_padding_mask:
            :math:`(N, K)` where N is the batch size, K is the key number, E is the embedding size.`
        value_padding_mask:
            :math:`(N, K, L)` where N is the batch size, K is the key number, L is the value length size.`
        fusing: fusing type

    Returns:
        - output: fused representation for key-value pair
    """
    if fusing == 'max-pool-value':
        value, _ = value.max(dim=0)
        return key + value, key_padding_mask
    elif fusing == 'expand-key':
        key = key.unsqueeze(0)
        return key + value, value_padding_mask
    else:
        raise NotImplementedError