class_docstr: An episodic ReplayBuffer with Uniform sampling.
class_docstr_tok: ["An","episodic","ReplayBuffer","with","Uniform","sampling","."]
docstr: Increments the episode_id when begin_episode is True.
  
  Args:
    episode_id: A Tensor containing the current episode_id.
    begin_episode: A Boolean Tensor whether should increment the episode_id.
    end_episode: A Boolean Tensor whether should end the episode_id.
  
  Returns:
    An updated episode id value.  Accessing this episode id value will,
    as a side effect, start or end the current episode in the var.
code: def _get_episode_id(
      self, episode_id, begin_episode=False, end_episode=False
  ):
      """Increments the episode_id when begin_episode is True.
  
      Args:
        episode_id: A Tensor containing the current episode_id.
        begin_episode: A Boolean Tensor whether should increment the episode_id.
        end_episode: A Boolean Tensor whether should end the episode_id.
  
      Returns:
        An updated episode id value.  Accessing this episode id value will,
        as a side effect, start or end the current episode in the var.
      """
  
      def _assign_new_episode_id():
          """Increment the episode_id inside a critical section."""
          new_episode_id = self._last_episode.assign_add(1)
          episode_location = self._get_episode_id_location(
              new_episode_id
          )
          update_mapping = tf.compat.v1.scatter_update(
              self._episodes_loc_to_id_map,
              episode_location,
              new_episode_id,
          )
          update_completed = tf.compat.v1.scatter_update(
              self._episode_completed, episode_location, 0
          )
          reset_data = self._data_table.clear_rows(
              tf.expand_dims(episode_location, 0)
          )
          reset_length = tf.compat.v1.scatter_update(
              self._episode_lengths, episode_location, 0
          )
          with tf.control_dependencies(
              [
                  update_mapping,
                  update_completed,
                  reset_data,
                  reset_length,
              ]
          ):
              return tf.identity(new_episode_id)
  
      def _get_new_episode_id():
          return self._add_episode_critical_section.execute(
              _assign_new_episode_id
          )
  
      begin_episode = tf.convert_to_tensor(
          value=begin_episode, name="begin_episode"
      )
      end_episode = tf.convert_to_tensor(
          value=end_episode, name="end_episode"
      )
      # If episode_id value is still -1 we need to assign a proper value.
      pred_value = begin_episode | (episode_id < 0)
      if pred_value.shape.rank != 0:
          raise ValueError(
              "Invalid condition predicate shape: {} (should be scalar).".format(
                  pred_value.shape
              )
          )
      updated_episode_id = tf.cond(
          pred=pred_value,
          true_fn=_get_new_episode_id,
          false_fn=lambda: tf.identity(episode_id),
          name="get_episode_id",
      )
  
      # _maybe_end_episode acquires the critical section.
      mark_completed = self._maybe_end_episode(
          updated_episode_id, end_episode
      )
      with tf.control_dependencies([mark_completed]):
          updated_episode_id = tf.identity(updated_episode_id)
      return updated_episode_id
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  import gin
  import tensorflow
  from tf_agents import specs
  from tf_agents.replay_buffers import episodic_table
  from tf_agents.replay_buffers import replay_buffer
  from tf_agents.replay_buffers import table
  from tf_agents.utils import common
  from tensorflow.python.data.util import nest
  from tensorflow.python.layers import utils
  from tensorflow.python.ops import list_ops
  from tensorflow.python.ops.distributions import util
label_desc: Use image node_id 19 for calling the EpisodicReplayBuffer obj's underlying member method code with example usage: obj._get_episode_id(episode_id, begin_episode, end_episode) and returns: updated_episode_id, self, tf