import tensorflow as tf

    word_probs = _clip_and_normalize(word_probs, epsilon)

    one_hot_spare_rep = tf.one_hot(answers, vsize)

    xent = -tf.reduce_sum(one_hot_spare_rep * tf.log(word_probs), axis=-1) # [batch_size, max_dec_steps]
    if loss_weights != None:
        xent = xent * loss_weights
    xent = tf.reduce_sum(xent, axis=-1)
