from tensorflow.python.ops import variable_scope

        sampled_words = []
        self.encoder_features = encoder_features
        with variable_scope.variable_scope("attention_decoder"):
            # Get the weight vectors v and W_c (W_c is for coverage)
            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
            if options.use_coverage:
                with variable_scope.variable_scope("coverage"):
                    w_c = variable_scope.get_variable("w_c", [options.attention_vec_size])
                    w_c = tf.expand_dims(tf.expand_dims(w_c, axis=0), axis=0)

            # For each step, dec_input => lstm_output => vocab_score
            wordidx_t = decoder_inputs[0] # [batch_size] int32
            for i in range(options.max_answer_len):
                if mode_gen in ('ce_train', 'loss',): wordidx_t = decoder_inputs[i] # the wordidx_t must from decoder_inputs for phrase model
