from tensorflow.python.ops import nn_ops

            return None, self._loss, sampled_words

    def calculate_encoder_features(self, encoder_states, encoder_dim):
        options = self.options
        input_shape = tf.shape(encoder_states)
        batch_size = input_shape[0]
        passage_len = input_shape[1]

        with variable_scope.variable_scope("attention_decoder"):
            encoder_features = tf.expand_dims(encoder_states, axis=2) # now is shape [batch_size, passage_len, 1, encoder_dim]
            W_h = variable_scope.get_variable("W_h", [1, 1, encoder_dim, options.attention_vec_size])
            self.W_h = W_h
            encoder_features = nn_ops.conv2d(encoder_features, W_h, [1, 1, 1, 1], "SAME") # [batch_size, passage_len, 1, attention_vec_size]
            encoder_features = tf.reshape(encoder_features, [batch_size, passage_len, options.attention_vec_size])
        return encoder_features

    def decode_mode(self, word_vocab, beam_size, state_t_1, context_t_1, coverage_t_1, word_t,
                    encoder_states, encoder_features, passage_word_idx, passage_mask):
        options = self.options

        with variable_scope.variable_scope("attention_decoder"):
            v = variable_scope.get_variable("v", [options.attention_vec_size])
            v = tf.expand_dims(tf.expand_dims(v, axis=0), axis=0)
            w_c = None
