def _summarize_losses(self, losses_dict):
    """Adds `tf.summary`s to all terms in the losses dictionary."""
    super(TransformerAE, self)._summarize_losses(losses_dict)
    nats_per_dim, bits_per_dim = latent_layers.compute_nats_and_bits_per_dim(
        data_dim=self._data_dim,
        latent_dim=self._latent_dim,
        average_reconstruction=losses_dict["training"],
        average_prior=losses_dict["latent_pred"])
    tf.summary.scalar("loss/nats_per_dim", nats_per_dim)
    tf.summary.scalar("loss/bits_per_dim", bits_per_dim)
Adds `tf.summary`s to all terms in the losses dictionary.
tensor2tensor/models/research/transformer_vae.py