class_docstr: An episodic ReplayBuffer with Uniform sampling.
class_docstr_tok: ["An","episodic","ReplayBuffer","with","Uniform","sampling","."]
docstr: Returns a new tensor containing initial invalid episode ID(s).
  
  This tensor is meant to be passed to methods like `add_batch` and
  `extend_episodes`; those methods will return an updated set of episode id
  values in their output.  To keep track of updated episode IDs across
  multiple TF1 session run calls, the `episode_ids` may be read out and passed
  back in by the user, or stored in a `tf.Variable`.  A helper class which
  does this for you is available in this module, it is called
  `StatefulEpisodicReplayBuffer`.
  
  A simple non-`Variable` way to do this (in TF1) is:
  
  ```python
  data = collect_data_tf_op()
  episode_ids = tf.placeholder_with_default(rb.create_episode_ids(3), [3])
  new_episode_ids = rb.add_batch(data, episode_ids)
  
  ids = session.run(episode_ids)
  while True:
    ...
    ids = session.run(new_episode_ids, feed_dict=dict(episode_ids=ids))
  ```
  
  The initial value of these ids is subject to change, but currently set
  to `-1`.  When methods like `add_batch` see entries like this, they
  reserve a new (valid) id for this entry in the buffer and return the
  associated id in this location.
  
  Args:
    num_episodes: (Optional) int32, number of episode IDs to create. This may
      be a tensor.  If `None`, a scalar ID tensor is returned.
  
  Returns:
    An int64 Tensor containing initial episode(s) ID(s).
  
  Raises:
    ValueError: If `num_episodes` is bigger than capacity, or non-scalar.
code: def create_episode_ids(self, num_episodes=None):
      """Returns a new tensor containing initial invalid episode ID(s).
  
      This tensor is meant to be passed to methods like `add_batch` and
      `extend_episodes`; those methods will return an updated set of episode id
      values in their output.  To keep track of updated episode IDs across
      multiple TF1 session run calls, the `episode_ids` may be read out and passed
      back in by the user, or stored in a `tf.Variable`.  A helper class which
      does this for you is available in this module, it is called
      `StatefulEpisodicReplayBuffer`.
  
      A simple non-`Variable` way to do this (in TF1) is:
  
      ```python
      data = collect_data_tf_op()
      episode_ids = tf.placeholder_with_default(rb.create_episode_ids(3), [3])
      new_episode_ids = rb.add_batch(data, episode_ids)
  
      ids = session.run(episode_ids)
      while True:
        ...
        ids = session.run(new_episode_ids, feed_dict=dict(episode_ids=ids))
      ```
  
      The initial value of these ids is subject to change, but currently set
      to `-1`.  When methods like `add_batch` see entries like this, they
      reserve a new (valid) id for this entry in the buffer and return the
      associated id in this location.
  
      Args:
        num_episodes: (Optional) int32, number of episode IDs to create. This may
          be a tensor.  If `None`, a scalar ID tensor is returned.
  
      Returns:
        An int64 Tensor containing initial episode(s) ID(s).
  
      Raises:
        ValueError: If `num_episodes` is bigger than capacity, or non-scalar.
      """
      if tf.is_tensor(num_episodes):
          if num_episodes.shape.rank != 0:
              raise ValueError(
                  "num_episodes must be a scalar, but saw shape: {}".format(
                      num_episodes.shape
                  )
              )
          return tf.fill(
              [num_episodes],
              tf.convert_to_tensor(_INVALID_EPISODE_ID, dtype=tf.int64),
              name="episode_id",
          )
  
      shape = ()
      if num_episodes is not None and num_episodes > 0:
          if num_episodes > self._capacity:
              raise ValueError(
                  "Buffer cannot create episode_ids when "
                  "num_episodes {} > capacity {}.".format(
                      num_episodes, self._capacity
                  )
              )
          shape = (num_episodes,)
      return tf.constant(
          _INVALID_EPISODE_ID,
          shape=shape,
          dtype=tf.int64,
          name="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 5 for calling the EpisodicReplayBuffer obj's underlying member method code with example usage: obj.create_episode_ids(num_episodes) and returns: tf, tf