import tensorflow as tf

                    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',):
