def get_num_train_frames(self):
    """Returns the number of frames as a normalizing factor."""
    num_target = self.hparams.video_num_target_frames
    num_input = self.hparams.video_num_input_frames

    # For unconditional generation, this picks a random frame during training
    # and evaluates the marginal likelihood over "num_input" + "num_target"
    # frames during eval.
    if self.hparams.gen_mode == "unconditional":
      if self.is_training:
        return 1
      return num_input + num_target

    # During eval we measure the true objective.
    if not self.is_training or self.hparams.num_train_frames == -1:
      total_frames = num_target
    # if hparams.num_train_frames=-1, we use an approxination to the true
    # objective.
    else:
      total_frames = self.hparams.num_train_frames - num_input
    if self.hparams.model_input:
      total_frames += num_input
    return total_frames
Returns the number of frames as a normalizing factor.
tensor2tensor/models/video/next_frame_glow.py