import tensorflow as tf

            # shape (batch_size, attn_size).
            context_vector = tf.reduce_sum(tf.expand_dims(attn_dist, axis=-1) * encoder_states, axis=1) # [batch_size, encoder_dim]
        return context_vector, attn_dist, coverage

    def embedding_lookup(self, inputs):
        '''
        inputs: list of [batch_size], int32
        '''
        if type(inputs) is list:
            return [tf.nn.embedding_lookup(self.embedding, x) for x in inputs]
        else:
            return tf.nn.embedding_lookup(self.embedding, inputs)

    def one_step_decoder(self, state_t_1, context_t_1, coverage_t_1, word_t, encoder_states, encoder_features,
                         passage_word_idx, passage_mask, v, w_c, vocab):
        '''
        state_t_1: Tuple of [batch_size, gen_hidden_size]
        context_t_1: [batch_size, encoder_dim]
        coverage_t_1: [batch_size, passage_len]
        word_t: [batch_size, word_dim]
        encoder_states: [batch_size, passage_len, encoder_dim]
        encoder_features: [batch_size,attn_length,attention_vec_size]
