import tensorflow as tf

        context_vectors.append(context_vector)
        weights.append(weights_)

    context_vector = tf.concat(context_vectors, axis=-1)
    weights = sum(weights) / len(weights)

    if encoder.attn_mapping:
        with tf.variable_scope(scope):
            context_vector = dense(context_vector, encoder.attn_mapping, use_bias=False, name='output')

    return context_vector, weights


def multi_attention(state, hidden_states, encoders, encoder_input_length, pos=None, aggregation_method='sum',
