class_docstr: Batch of environments inside the TensorFlow graph.
  
  The batch of environments will be stepped and reset inside of the graph using
  a tf.py_func(). The current batch of observations, actions, rewards, and done
  flags are held in according variables.
code: def simulate(self, action):
      with tf.name_scope("environment/simulate"):
          actions = tf.concat(
              [tf.expand_dims(action, axis=1)] * self._num_frames,
              axis=1,
          )
          history = self.history_buffer.get_all_elements()
          with tf.variable_scope(
              tf.get_variable_scope(), reuse=tf.AUTO_REUSE
          ):
              # We only need 1 target frame here, set it.
              hparams_target_frames = (
                  self._model.hparams.video_num_target_frames
              )
              self._model.hparams.video_num_target_frames = 1
              model_output = self._model.infer(
                  {
                      "inputs": history,
                      "input_action": actions,
                      "reset_internal_states": self._reset_model.read_value(),
                  }
              )
              self._model.hparams.video_num_target_frames = (
                  hparams_target_frames
              )
  
          observ = tf.cast(
              tf.squeeze(model_output["targets"], axis=1),
              self.observ_dtype,
          )
  
          reward = tf.to_float(model_output["target_reward"])
          reward = (
              tf.reshape(reward, shape=(self.batch_size,))
              + self._min_reward
          )
  
          if self._intrinsic_reward_scale:
              # Use the model's uncertainty about its prediction as an intrinsic
              # reward. The uncertainty is measured by the log probability of the
              # predicted pixel value.
              if "targets_logits" not in model_output:
                  raise ValueError(
                      "The use of intrinsic rewards requires access to "
                      "the logits. Ensure that model.infer returns "
                      "'targets_logits'"
                  )
              uncertainty_reward = compute_uncertainty_reward(
                  model_output["targets_logits"],
                  model_output["targets"],
              )
              uncertainty_reward = tf.minimum(
                  1.0, self._intrinsic_reward_scale * uncertainty_reward
              )
              uncertainty_reward = tf.Print(
                  uncertainty_reward,
                  [uncertainty_reward],
                  message="uncertainty_reward",
                  first_n=1,
                  summarize=8,
              )
              reward += uncertainty_reward
  
          done = tf.constant(False, tf.bool, shape=(self.batch_size,))
  
          with tf.control_dependencies([observ]):
              dump_frame_op = tf.cond(
                  self._video_condition,
                  lambda: tf.py_func(
                      self._video_dump_frame,  # pylint: disable=g-long-lambda
                      [observ, reward],
                      [],
                  ),
                  tf.no_op,
              )
              with tf.control_dependencies(
                  [
                      self._observ.assign(observ),
                      self.history_buffer.move_by_one_element(observ),
                      dump_frame_op,
                  ]
              ):
                  clear_reset_model_op = tf.assign(
                      self._reset_model, tf.constant(0.0)
                  )
                  with tf.control_dependencies([clear_reset_model_op]):
                      return tf.identity(reward), tf.identity(done)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import copy
  import os
  import numpy
  from tensor2tensor.data_generators.gym_env import DummyWorldModelProblem
  from tensor2tensor.layers import common_layers
  from tensor2tensor.layers import common_video
  from tensor2tensor.rl.envs import in_graph_batch_env
  from tensor2tensor.utils import registry
  from tensor2tensor.utils import trainer_lib
  import tensorflow.compat.v1
  from tensorflow.compat.v1 import estimator
label_desc: Use image node_id 5 for calling the SimulatedBatchEnv obj's underlying member method code with example usage: obj.simulate(action) and returns: tf,  tf