class_docstr: Probabilistic encoder for the time-invariant latent variable `f`.
  
  The conditional distribution `q(f | x_{1:T})` is a multivariate
  normal distribution on `R^{latent_size}` at each timestep `t`,
  conditioned on intermediate representations of `x_{1:T}` from the
  convolutional encoder. The parameters are computed by passing the
  inputs through a bidirectional LSTM function, then passing the final
  output to an affine function to yield normal parameters for
  `q(f | x_{1:T})`.
  
  Together with the EncoderDynamicFactorized class, we can formulate the
  factorized approximate latent posterior `q` inference ("encoder")
  model as
  
  ```none
  q(z_{1:T}, f | x_{1:T}) = q(f | x_{1:T}) prod_{t=1}^T q(z_t | x_t).
  ```
  
  Together with the EncoderDynamicFull class, we can formulate the full
  approximate latent posterior `q` inference ("encoder") model as
  
  ```none
  q(z_{1:T}, f | x_{1:T}) = q(f | x_{1:T}) q(z_{1:T} | f, x_{1:T}).
  ```
class_docstr_tok: ["Probabilistic","encoder","for","the","time-invariant","latent","variable","`","f","`",".","The","conditional","distribution","`","q","(","f","|","x_","{","1",":","T","}",")","`","is","a","multivariate","normal","distribution","on","`","R^","{","latent_size","}","`","at","each","timestep","`","t","`",",","conditioned","on","intermediate","representations","of","`","x_","{","1",":","T","}","`","from","the","convolutional","encoder",".","The","parameters","are","computed","by","passing","the","inputs","through","a","bidirectional","LSTM","function",",","then","passing","the","final","output","to","an","affine","function","to","yield","normal","parameters","for","`","q","(","f","|","x_","{","1",":","T","}",")","`",".","Together","with","the","EncoderDynamicFactorized","class",",","we","can","formulate","the","factorized","approximate","latent","posterior","`","q","`","inference","(","``","encoder","''",")","model","as","``","`","none","q","(","z_","{","1",":","T","}",",","f","|","x_","{","1",":","T","}",")","=","q","(","f","|","x_","{","1",":","T","}",")","prod_","{","t=1","}","^T","q","(","z_t","|","x_t",")",".","``","`","Together","with","the","EncoderDynamicFull","class",",","we","can","formulate","the","full","approximate","latent","posterior","`","q","`","inference","(","``","encoder","''",")","model","as","``","`","none","q","(","z_","{","1",":","T","}",",","f","|","x_","{","1",":","T","}",")","=","q","(","f","|","x_","{","1",":","T","}",")","q","(","z_","{","1",":","T","}","|","f",",","x_","{","1",":","T","}",")",".","``","`"]
docstr: Runs the model to generate a distribution `q(f | x_{1:T})`.
  
  This generates a list of batched MultivariateNormalDiag
  distributions using the output of the recurrent model at each
  timestep to parameterize each distribution.
  
  Args:
    inputs: A batch of intermediate representations of image frames
      across all timesteps, of shape [..., batch_size, timesteps,
      hidden_size].
  
  Returns:
    A batched MultivariateNormalDiag distribution with event shape
    [latent_size], batch shape [..., batch_size], and sample shape
    [sample_shape, ..., batch_size, latent_size].
code: def call(self, inputs):
      """Runs the model to generate a distribution `q(f | x_{1:T})`.
  
      This generates a list of batched MultivariateNormalDiag
      distributions using the output of the recurrent model at each
      timestep to parameterize each distribution.
  
      Args:
        inputs: A batch of intermediate representations of image frames
          across all timesteps, of shape [..., batch_size, timesteps,
          hidden_size].
  
      Returns:
        A batched MultivariateNormalDiag distribution with event shape
        [latent_size], batch shape [..., batch_size], and sample shape
        [sample_shape, ..., batch_size, latent_size].
      """
      # TODO(dusenberrymw): Remove these reshaping commands after b/113126249 is
      # fixed.
      collapsed_shape = tf1.concat(
          ([-1], tf1.shape(input=inputs)[-2:]), axis=0
      )
      out = tf1.reshape(
          inputs, collapsed_shape
      )  # (sample*batch_size, T, hidden)
      out = self.bilstm(out)  # (sample*batch_size, hidden)
      expanded_shape = tf1.concat(
          (tf1.shape(input=inputs)[:-2], [-1]), axis=0
      )
      out = tf1.reshape(
          out, expanded_shape
      )  # (sample, batch_size, hidden)
      out = self.output_layer(
          out
      )  # (sample, batch_size, 2*latent_size)
      loc = out[..., : self.latent_size]
      scale_diag = (
          tf1.nn.softplus(out[..., self.latent_size :]) + 1e-5
      )  # keep > 0
      return tfd.MultivariateNormalDiag(loc=loc, scale_diag=scale_diag)
  
imports: from datetime import datetime
  import functools
  from absl import app
  from absl import flags
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  import tensorflow_probability
  from tensorflow_probability.examples import sprites_dataset
  from tensorflow_probability.python.internal import tf_keras
label_desc: Use image node_id 2 for calling the EncoderStatic obj's underlying member method code with example usage: obj.call(inputs) and returns: tfd