class_docstr: Stochastic Variational Video Prediction From Basic Model!
class_docstr_tok: ["Stochastic","Variational","Video","Prediction","From","Basic","Model","!"]
docstr: The bottom part of predictive towers.
  
  With the current (early) design, the main prediction tower and
  the reward prediction tower share the same arcitecture. TF Scope can be
  adjusted as required to either share or not share the weights between
  the two towers.
  
  Args:
    input_image: the current image.
    input_reward: the current reward.
    action: the action taken by the agent.
    latent: the latent vector.
    lstm_state: the current internal states of conv lstms.
    lstm_size: the size of lstms.
    conv_size: the size of convolutions.
    concat_latent: whether or not to concatenate the latent at every step.
  
  Returns:
    - the output of the partial network.
    - intermidate outputs for skip connections.
docstr_tok: ["The","bottom","part","of","predictive","towers",".","With","the","current","(","early",")","design",",","the","main","prediction","tower","and","the","reward","prediction","tower","share","the","same","arcitecture",".","TF","Scope","can","be","adjusted","as","required","to","either","share","or","not","share","the","weights","between","the","two","towers",".","Args",":","input_image",":","the","current","image",".","input_reward",":","the","current","reward",".","action",":","the","action","taken","by","the","agent",".","latent",":","the","latent","vector",".","lstm_state",":","the","current","internal","states","of","conv","lstms",".","lstm_size",":","the","size","of","lstms",".","conv_size",":","the","size","of","convolutions",".","concat_latent",":","whether","or","not","to","concatenate","the","latent","at","every","step",".","Returns",":","-","the","output","of","the","partial","network",".","-","intermidate","outputs","for","skip","connections","."]
code: def bottom_part_tower(
      self,
      input_image,
      input_reward,
      action,
      latent,
      lstm_state,
      lstm_size,
      conv_size,
      concat_latent=False,
  ):
      """The bottom part of predictive towers.
  
      With the current (early) design, the main prediction tower and
      the reward prediction tower share the same arcitecture. TF Scope can be
      adjusted as required to either share or not share the weights between
      the two towers.
  
      Args:
        input_image: the current image.
        input_reward: the current reward.
        action: the action taken by the agent.
        latent: the latent vector.
        lstm_state: the current internal states of conv lstms.
        lstm_size: the size of lstms.
        conv_size: the size of convolutions.
        concat_latent: whether or not to concatenate the latent at every step.
  
      Returns:
        - the output of the partial network.
        - intermidate outputs for skip connections.
      """
      lstm_func = common_video.conv_lstm_2d
      tile_and_concat = common_video.tile_and_concat
  
      input_image = common_layers.make_even_size(input_image)
      concat_input_image = tile_and_concat(
          input_image, latent, concat_latent=concat_latent
      )
  
      layer_id = 0
      enc0 = tfl.conv2d(
          concat_input_image,
          conv_size[0],
          [5, 5],
          strides=(2, 2),
          activation=tf.nn.relu,
          padding="SAME",
          name="scale1_conv1",
      )
      enc0 = tfcl.layer_norm(enc0, scope="layer_norm1")
  
      hidden1, lstm_state[layer_id] = lstm_func(
          enc0, lstm_state[layer_id], lstm_size[layer_id], name="state1"
      )
      hidden1 = tile_and_concat(
          hidden1, latent, concat_latent=concat_latent
      )
      hidden1 = tfcl.layer_norm(hidden1, scope="layer_norm2")
      layer_id += 1
  
      hidden2, lstm_state[layer_id] = lstm_func(
          hidden1,
          lstm_state[layer_id],
          lstm_size[layer_id],
          name="state2",
      )
      hidden2 = tfcl.layer_norm(hidden2, scope="layer_norm3")
      hidden2 = common_layers.make_even_size(hidden2)
      enc1 = tfl.conv2d(
          hidden2,
          hidden2.get_shape()[3],
          [3, 3],
          strides=(2, 2),
          padding="SAME",
          activation=tf.nn.relu,
          name="conv2",
      )
      enc1 = tile_and_concat(enc1, latent, concat_latent=concat_latent)
      layer_id += 1
  
      if self.hparams.small_mode:
          hidden4, enc2 = hidden2, enc1
      else:
          hidden3, lstm_state[layer_id] = lstm_func(
              enc1,
              lstm_state[layer_id],
              lstm_size[layer_id],
              name="state3",
          )
          hidden3 = tile_and_concat(
              hidden3, latent, concat_latent=concat_latent
          )
          hidden3 = tfcl.layer_norm(hidden3, scope="layer_norm4")
          layer_id += 1
  
          hidden4, lstm_state[layer_id] = lstm_func(
              hidden3,
              lstm_state[layer_id],
              lstm_size[layer_id],
              name="state4",
          )
          hidden4 = tile_and_concat(
              hidden4, latent, concat_latent=concat_latent
          )
          hidden4 = tfcl.layer_norm(hidden4, scope="layer_norm5")
          hidden4 = common_layers.make_even_size(hidden4)
          enc2 = tfl.conv2d(
              hidden4,
              hidden4.get_shape()[3],
              [3, 3],
              strides=(2, 2),
              padding="SAME",
              activation=tf.nn.relu,
              name="conv3",
          )
          layer_id += 1
  
      if action is not None:
          enc2 = common_video.inject_additional_input(
              enc2, action, "action_enc", self.hparams.action_injection
          )
      if input_reward is not None:
          enc2 = common_video.inject_additional_input(
              enc2, input_reward, "reward_enc"
          )
      if latent is not None and not concat_latent:
          with tf.control_dependencies([latent]):
              enc2 = tf.concat([enc2, latent], axis=3)
  
      enc3 = tfl.conv2d(
          enc2,
          hidden4.get_shape()[3],
          [1, 1],
          strides=(1, 1),
          padding="SAME",
          activation=tf.nn.relu,
          name="conv4",
      )
  
      hidden5, lstm_state[layer_id] = lstm_func(
          enc3, lstm_state[layer_id], lstm_size[layer_id], name="state5"
      )
      hidden5 = tfcl.layer_norm(hidden5, scope="layer_norm6")
      hidden5 = tile_and_concat(
          hidden5, latent, concat_latent=concat_latent
      )
      layer_id += 1
      return hidden5, (enc0, enc1), layer_id
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from tensor2tensor.layers import common_layers
  from tensor2tensor.layers import common_video
  from tensor2tensor.layers import discretization
  from tensor2tensor.models.video import base
  from tensor2tensor.models.video import base_vae
  from tensor2tensor.utils import contrib
  from tensor2tensor.utils import registry
  import tensorflow.compat.v1
label_desc: Use image node_id 3 for calling the NextFrameSv2p obj's underlying member method code with example usage: obj.bottom_part_tower(input_image, input_reward, action, latent, lstm_state, lstm_size, conv_size, concat_latent) and returns: hidden5,  enc0,  enc1,  layer_id