class_docstr: Extend Glow for video.
code: def objective_tower(self, features, init=False):
      input_frames, target_frames = (
          features["inputs"],
          features["targets"],
      )
      self.cond_latents, self.top_state = None, None
      self.all_level_latents, self.all_top_latents = [], []
      self._all_conds = []
      self.level_states = [None] * (self.hparams.n_levels - 1)
      self.z_top_shape = self.get_z_top_shape(init=init)
      num_input_frames = self.hparams.video_num_input_frames
      latent_dist_encoder = self.hparams.latent_dist_encoder
      num_cond_latents = self.hparams.num_cond_latents
  
      exp_modes = ["conditional", "unconditional"]
      if self.hparams.gen_mode not in exp_modes:
          raise ValueError(
              "Expected mode to be in %s, got %s"
              % (exp_modes, self.hparams.gen_mode)
          )
  
      # Error checks for conditional video generation.
      if self.hparams.gen_mode == "conditional":
          exp_latent_encoders = [
              "pointwise",
              "conv_net",
              "conv_lstm",
              "conv3d_net",
          ]
          if latent_dist_encoder not in exp_latent_encoders:
              raise ValueError(
                  "Expected latent_dist_encoder is %s, got %s"
                  % (exp_latent_encoders, latent_dist_encoder)
              )
          if (
              latent_dist_encoder == "pointwise"
              and num_cond_latents != 1
          ):
              raise ValueError(
                  "Expected num_cond_latents: 1, with 'pointwise' "
                  "latent_dist_encoder, got %d" % num_cond_latents
              )
          if (
              latent_dist_encoder == "conv_net"
              and num_cond_latents > num_input_frames
          ):
              raise ValueError(
                  "Expected num_cond_latents <= %d, got %d"
                  % (num_input_frames, num_cond_latents)
              )
          if (
              latent_dist_encoder == "pointwise"
              and self.hparams.init_batch_size
              != self.hparams.batch_size
          ):
              raise ValueError(
                  "init_batch_size different from batch_size not "
                  "supported for latent_dist_encoder=pointwise"
              )
      if self.hparams.gen_mode == "unconditional":
          if self.hparams.num_train_frames != 1:
              raise ValueError(
                  "Expected num_train_frames to be 1 when "
                  "hparams.gen_mode is unconditional, got %d"
                  % self.hparams.num_train_frames
              )
          if self.hparams.video_num_input_frames != 1:
              raise ValueError(
                  "Expected num_input_frames to be 1 when "
                  "hparams.gen_mode is unconditional, got %d"
                  % self.hparams.video_num_input_frames
              )
      return self.video_objective_tower(
          input_frames, target_frames, init=init
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  from six.moves import range
  from tensor2tensor.layers import common_layers
  from tensor2tensor.layers import common_video
  from tensor2tensor.layers import modalities
  from tensor2tensor.models.research import glow
  from tensor2tensor.models.research import glow_ops
  from tensor2tensor.utils import contrib
  from tensor2tensor.utils import registry
  import tensorflow.compat.v1
  import tensorflow_probability
label_desc: Use image node_id 16 for calling the NextFrameGlow obj's underlying member method code with example usage: obj.objective_tower(features, init) and returns: self