class_docstr: Main function for Stochastic Adversarial Video Prediction.
docstr: Convnet that encodes inputs into mean and std of a gaussian.
  
  Args:
   inputs: 5-D Tensor, shape (batch_size, num_frames, width, height, channels)
   n_layers: Number of layers.
  
  Returns:
   z_mu: Mean of the latent gaussians.
   z_log_var: log(var) of the latent gaussians.
  
  Raises:
    ValueError: If inputs is not a 5-D tensor or not float32.
docstr_tok: ["Convnet","that","encodes","inputs","into","mean","and","std","of","a","gaussian",".","Args",":","inputs",":","5-D","Tensor",",","shape","(","batch_size",",","num_frames",",","width",",","height",",","channels",")","n_layers",":","Number","of","layers",".","Returns",":","z_mu",":","Mean","of","the","latent","gaussians",".","z_log_var",":","log","(","var",")","of","the","latent","gaussians",".","Raises",":","ValueError",":","If","inputs","is","not","a","5-D","tensor","or","not","float32","."]
code: def encoder(self, inputs, n_layers=3):
      """Convnet that encodes inputs into mean and std of a gaussian.
  
      Args:
       inputs: 5-D Tensor, shape (batch_size, num_frames, width, height, channels)
       n_layers: Number of layers.
  
      Returns:
       z_mu: Mean of the latent gaussians.
       z_log_var: log(var) of the latent gaussians.
  
      Raises:
        ValueError: If inputs is not a 5-D tensor or not float32.
      """
      latent_dims = self.hparams.z_dim
  
      shape_as_list = inputs.shape.as_list()
      if len(shape_as_list) != 5:
          raise ValueError(
              "Expected inputs to be a 5-D, got %d" % len(shape_as_list)
          )
      if inputs.dtype != tf.float32:
          raise ValueError(
              "Expected dtype tf.float32, got %s" % inputs.dtype
          )
  
      # Flatten (N,T,W,H,C) into (NT,W,H,C)
      batch_size, _ = shape_as_list[:2]
      inputs = tf.reshape(inputs, [-1] + list(inputs.shape)[2:])
      n_filters = 64
      rectified = None
  
      # Applies 3 layer conv-net with padding, instance normalization
      # and leaky relu as per the encoder in
      # https://github.com/alexlee-gk/video_prediction
      padding = [[0, 0], [1, 1], [1, 1], [0, 0]]
      for i in range(n_layers):
          with tf.variable_scope("layer_%d" % (i + 1)):
              n_filters *= 2**i
              if i:
                  padded = tf.pad(rectified, padding)
              else:
                  padded = tf.pad(inputs, padding)
              convolved = tf.layers.conv2d(
                  padded,
                  filters=n_filters,
                  kernel_size=4,
                  strides=2,
                  padding="VALID",
              )
              normalized = contrib.layers().instance_norm(convolved)
              rectified = tf.nn.leaky_relu(normalized, alpha=0.2)
  
      # Mean pooling across all spatial dimensions.
      pooled = tf.nn.avg_pool(
          rectified,
          [1] + rectified.shape[1:3].as_list() + [1],
          strides=[1, 1, 1, 1],
          padding="VALID",
      )
      squeezed = tf.squeeze(pooled, [1, 2])
  
      # Down-project and output the mean and log of the standard deviation of
      # the latents.
      with tf.variable_scope("z_mu"):
          z_mu = tf.layers.dense(squeezed, latent_dims)
      with tf.variable_scope("z_log_sigma_sq"):
          z_log_var = tf.layers.dense(squeezed, latent_dims)
          z_log_var = tf.clip_by_value(z_log_var, -10, 10)
  
      # Reshape to (batch_size X num_frames X latent_dims)
      z_mu = tf.reshape(z_mu, (batch_size, -1, latent_dims))
      z_log_var = tf.reshape(z_log_var, (batch_size, -1, latent_dims))
      return z_mu, z_log_var
  
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 1 for calling the NextFrameSavpBase obj's underlying member method code with example usage: obj.encoder(inputs, n_layers) and returns: z_mu,  z_log_var