import tensorflow as tf

    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])
                tf.summary.histogram("mel_targets %d" % i, model.tower_linear_targets[i])
        
        tf.summary.scalar("regularization_loss", model.regularization_loss)
        tf.summary.scalar("stop_token_loss", model.stop_token_loss)
        tf.summary.scalar("loss", model.loss)
        tf.summary.scalar("learning_rate", model.learning_rate)  # Control learning rate decay speed
        if hparams.tacotron_teacher_forcing_mode == "scheduled":
            tf.summary.scalar("teacher_forcing_ratio", model.ratio)  # Control teacher forcing 
        # ratio decay when mode = "scheduled"
        gradient_norms = [tf.norm(grad) for grad in model.gradients]
        tf.summary.histogram("gradient_norm", gradient_norms)
