class_docstr: Main function for Stochastic Adversarial Video Prediction.
docstr: Gets extra loss from VAE and GAN.
docstr_tok: ["Gets","extra","loss","from","VAE","and","GAN","."]
code: def get_extra_loss(
      self,
      latent_means=None,
      latent_stds=None,
      true_frames=None,
      gen_frames=None,
  ):
      """Gets extra loss from VAE and GAN."""
      if not self.is_training:
          return 0.0
  
      vae_loss, d_vae_loss, d_gan_loss = 0.0, 0.0, 0.0
      # Use sv2p's KL divergence computation.
      if self.hparams.use_vae:
          vae_loss = super(NextFrameSavpBase, self).get_extra_loss(
              latent_means=latent_means, latent_stds=latent_stds
          )
  
      if self.hparams.use_gan:
          # Strip out the first context_frames for the true_frames
          # Strip out the first context_frames - 1 for the gen_frames
          context_frames = self.hparams.video_num_input_frames
          true_frames = tf.stack(
              tf.unstack(true_frames, axis=0)[context_frames:]
          )
  
          # discriminator for VAE.
          if self.hparams.use_vae:
              gen_enc_frames = tf.stack(
                  tf.unstack(gen_frames, axis=0)[context_frames - 1 :]
              )
              d_vae_loss = self.get_gan_loss(
                  true_frames, gen_enc_frames, name="vae"
              )
  
          # discriminator for GAN.
          gen_prior_frames = tf.stack(
              tf.unstack(self.gen_prior_video, axis=0)[
                  context_frames - 1 :
              ]
          )
          d_gan_loss = self.get_gan_loss(
              true_frames, gen_prior_frames, name="gan"
          )
  
      return (
          vae_loss
          + self.hparams.gan_loss_multiplier * d_gan_loss
          + self.hparams.gan_vae_loss_multiplier * d_vae_loss
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numbers
  import numpy
  from tensor2tensor.layers import common_layers
  from tensor2tensor.layers import common_video
  from tensor2tensor.models.video import savp_params
  from tensor2tensor.models.video import sv2p
  from tensor2tensor.utils import contrib
  from tensor2tensor.utils import registry
  from tensor2tensor.utils import update_ops_hook
  import tensorflow.compat.v1
  from tensorflow.compat.v1 import estimator
  import tensorflow_gan
label_desc: Use image node_id 8 for calling the NextFrameSavpBase obj's underlying member method code with example usage: obj.get_extra_loss(latent_means, latent_stds, true_frames, gen_frames) and returns: unknown, int