class_docstr: A table that can store Episodes of variable length.
class_docstr_tok: ["A","table","that","can","store","Episodes","of","variable","length","."]
docstr: Creates a table.
  
  Args:
    tensor_spec: A nest of TensorSpec representing each value that can be
      stored in the table.
    capacity: Maximum number of values the table can store.
    name_prefix: optional name prefix for variable names.
  
  Raises:
    ValueError: If the names in tensor_spec are empty or not unique.
docstr_tok: ["Creates","a","table",".","Args",":","tensor_spec",":","A","nest","of","TensorSpec","representing","each","value","that","can","be","stored","in","the","table",".","capacity",":","Maximum","number","of","values","the","table","can","store",".","name_prefix",":","optional","name","prefix","for","variable","names",".","Raises",":","ValueError",":","If","the","names","in","tensor_spec","are","empty","or","not","unique","."]
code: def __init__(
      self, tensor_spec, capacity, name_prefix="EpisodicTable"
  ):
      """Creates a table.
  
      Args:
        tensor_spec: A nest of TensorSpec representing each value that can be
          stored in the table.
        capacity: Maximum number of values the table can store.
        name_prefix: optional name prefix for variable names.
  
      Raises:
        ValueError: If the names in tensor_spec are empty or not unique.
      """
      self._tensor_spec = tensor_spec
      self._capacity = capacity
      self._spec_names = []
  
      def _create_unique_slot_name(spec, count=0):
          name = spec.name or "slot"
          name = name + "_" + str(count)
          if name not in self._spec_names:
              self._spec_names.append(name)
              return name_prefix + "." + name
          else:
              return _create_unique_slot_name(spec, count + 1)
  
      self._slots = tf.nest.map_structure(
          _create_unique_slot_name, self._tensor_spec
      )
      self._flattened_slots = tf.nest.flatten(self._slots)
      self._flattened_specs = tf.nest.flatten(self._tensor_spec)
  
      def _create_storage(spec, slot_name):
          return tf.lookup.experimental.DenseHashTable(
              key_dtype=tf.int64,
              value_dtype=tf.variant,
              empty_key=-1,
              deleted_key=-2,
              name=slot_name,
              default_value=_empty_slot(spec),
          )
  
      self._storage = tf.nest.map_structure(
          _create_storage, self._tensor_spec, self._slots
      )
      self._variables = tf.nest.flatten(self._storage)
      self._slot2variable_map = dict(
          zip(self._flattened_slots, self._variables)
      )
      self._slot2spec_map = dict(
          zip(self._flattened_slots, self._flattened_specs)
      )
  
file_path: agents/tf_agents/replay_buffers/episodic_table.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import tensorflow
  from tf_agents.utils import nest_utils
  from tensorflow.python.ops import list_ops
label_desc: Use image node_id 1 to create a new EpisodicTable object from inherited base classes: tf with example: obj = EpisodicTable(tensor_spec, capacity, name_prefix)