import tensorflow as tf

                vocab_scores.append(output_t) # The vocabulary distributions.

                state_t_1 = state_t
                context_t_1 = context_t
                coverage_t_1 = coverage_t

                if mode_gen == 'greedy':
                    wordidx_t = tf.argmax(output_t, 1) # [batch_size]
                    wordidx_t = tf.reshape(wordidx_t, [-1]) # [batch_size]
                elif mode_gen == 'sample':
                    log_score_t = tf.log(output_t) # [batch_size, vsize]
                    wordidx_t = tf.multinomial(log_score_t, 1) # [batch_size, 1]
                    wordidx_t = tf.reshape(wordidx_t, [-1]) # [batch_size]
                elif mode_gen in ('ce_train', 'loss',):
                    wordidx_t = answer_batch_unstack[i]
                else:
