code: def get_cond_latents(all_latents=None, hparams=None):
    
    cond_latents = None
    if hparams.gen_mode == "conditional":
      if hparams.latent_dist_encoder in ["conv_net", "conv3d_net"]:
        num_cond_latents = (hparams.num_cond_latents +
                            int(hparams.cond_first_frame))
        if len(all_latents) >= num_cond_latents:
          cond_latents = all_latents[-hparams.num_cond_latents:]
          if hparams.cond_first_frame:
            cond_latents = [all_latents[0]] + cond_latents
      elif hparams.latent_dist_encoder in ["pointwise", "conv_lstm"]:
        if all_latents:
          cond_latents = all_latents[-1]
  
    if hparams.gen_mode == "conditional":
      global_step = tf.train.get_or_create_global_step()
      condition = tf.greater(global_step, hparams.pretrain_steps)
    else:
      condition = tf.constant(False, dtype=tf.bool)
    return condition, cond_latents
docs: Get z^{cond}_{t} given z^{1..t-1}.
  
    Args:
      all_latents: list of list of tensors,
                   outer-size equals no.of time_steps-1
                   inner-size equals hparams.n_levels.
      hparams: See next_frame_glow_hparams.
    Returns:
      cond_latents: conditional latents at time-step t.