import tensorflow as tf

    """
    if loss_weights == None:
        return tf.reduce_mean(tf.stack(values, axis=0))

    dec_lens = tf.reduce_sum(loss_weights, axis=1) # shape batch_size. float32
    values_per_step = [v * loss_weights[:,dec_step] for dec_step,v in enumerate(values)]
    values_per_ex = sum(values_per_step)/dec_lens # shape (batch_size); normalized value for each batch member
    return tf.reduce_mean(values_per_ex) # overall average
