def top_prior(self, condition=False, cond_latents=None):
    """Objective based on the prior over latent z.

    Args:
      condition: Whether or not to condition on cond_latents.
      cond_latents: tensor or list of tensors depending on
                    hparams.latent_dist_encoder
    Returns:
      objective: float, log-likelihood of z under the prior.
      dist: instance of tfp.distributions.Normal, prior distribution.
    Raises:
      ValueError: If input is smaller than the prior, uneven height
                  or rectangular.
    """
    if isinstance(condition, bool):
      condition = tf.constant(condition, dtype=tf.bool)
    self._all_conds.append(condition)

    if self.hparams.gen_mode == "conditional":
      # cond_top_latents is None when
      # latent_dist_encoder is a lstm and frame_ind == 0.
      # latent_dist_encoder is conv_net and frame_ind < num_cond_frames.
      marginal_mean, marginal_scale = self.uncond_top_dist()
      if cond_latents is None:
        mean, scale = marginal_mean, marginal_scale
      else:
        cond_mean, cond_scale = self.cond_top_dist(cond_latents)
        mean, scale = tf.cond(
            condition, lambda: (cond_mean, cond_scale),
            lambda: (marginal_mean, marginal_scale))
      return glow_ops.TemperedNormal(mean, scale, self.temperature)
    if self.hparams.top_prior == "prev_frame":
      return self.get_squeeze_prior()
    else:
      return super(NextFrameGlow, self).top_prior()
Objective based on the prior over latent z.

    Args:
      condition: Whether or not to condition on cond_latents.
      cond_latents: tensor or list of tensors depending on
                    hparams.latent_dist_encoder
    Returns:
      objective: float, log-likelihood of z under the prior.
      dist: instance of tfp.distributions.Normal, prior distribution.
    Raises:
      ValueError: If input is smaller than the prior, uneven height
                  or rectangular.
    
tensor2tensor/models/video/next_frame_glow.py