def log_sum_exp(xs):
    'Computes the log sum exp value of a tensor.'
    maxes = tf.reduce_max(xs, keep_dims=True)
    xs -= maxes
    return (tf.squeeze(maxes, [(- 1)]) + tf.log(tf.reduce_sum(tf.exp(xs), (- 1))))
Computes the log sum exp value of a tensor.
def log_sum_exp(xs):
    
    maxes = tf.reduce_max(xs, keep_dims=True)
    xs -= maxes
    return (tf.squeeze(maxes, [(- 1)]) + tf.log(tf.reduce_sum(tf.exp(xs), (- 1))))