import tensorflow as tf



def add_train_stats(model, hparams):
    with tf.variable_scope("stats") as scope:
        for i in range(hparams.tacotron_num_gpus):
            tf.summary.histogram("mel_outputs %d" % i, model.tower_mel_outputs[i])
            tf.summary.histogram("mel_targets %d" % i, model.tower_mel_targets[i])
        tf.summary.scalar("before_loss", model.before_loss)
        tf.summary.scalar("after_loss", model.after_loss)

        if hparams.predict_linear:
            tf.summary.scalar("linear_loss", model.linear_loss)
            for i in range(hparams.tacotron_num_gpus):
                tf.summary.histogram("mel_outputs %d" % i, model.tower_linear_outputs[i])
