code: def get_latent_pred_loss(latents_pred, latents_discrete_hot, hparams):
      """Latent prediction and loss."""
      latents_logits = tf.layers.dense(
          latents_pred,
          2**hparams.bottleneck_bits,
          name="extra_logits",
      )
      loss = tf.nn.softmax_cross_entropy_with_logits_v2(
          labels=tf.stop_gradient(latents_discrete_hot),
          logits=latents_logits,
      )
      return loss
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import functools
  from six.moves import range
  from tensor2tensor.layers import common_layers
  from tensor2tensor.models import transformer
  from tensor2tensor.utils import beam_search
  from tensor2tensor.utils import registry
  from tensor2tensor.utils import t2t_model
  import tensorflow.compat.v1
  from tensorflow.compat.v1 import estimator
  from tensorflow.python.training import moving_averages
label_desc: Use image node_id 10 for calling a global function with example usage: get_latent_pred_loss(latents_pred, latents_discrete_hot, hparams) and returns: loss