from tensorflow.python.ops import variable_scope

        decoder_state: Tuple of [batch_size, gen_hidden_size]
        encoder_states: [batch_size, passage_len, encoder_dim]
        encoder_features: [batch_size,passage_len,attention_vec_size]
        passage_mask: [batch_size, passage_len]
        v: [1,1, attention_vec_size]
        w_c: [1,1, attention_vec_size]
        coverage: [batch_size, passage_len]
        '''
        with variable_scope.variable_scope("Attention"):
            # Equation (11) in the paper
            state_features = linear(decoder_state, attention_vec_size, True) # [batch_size, attention_vec_size]
            state_features = tf.expand_dims(state_features, 1) # [batch_size, 1, attention_vec_size]
            all_features = encoder_features + state_features # [batch_size,passage_len,attention_vec_size]
            if use_coverage and coverage is not None:
                coverage_features = tf.expand_dims(coverage, axis=-1) * w_c # [batch_size, passage_len, attention_vec_size]
                all_features += coverage_features
