class_docstr: A Python-based replay buffer that supports uniform sampling.
  
  Writing and reading to this replay buffer is thread safe.
  
  This replay buffer can be subclassed to change the encoding used for the
  underlying storage by overriding _encoded_data_spec, _encode, _decode, and
  _on_delete.
class_docstr_tok: ["A","Python-based","replay","buffer","that","supports","uniform","sampling",".","Writing","and","reading","to","this","replay","buffer","is","thread","safe",".","This","replay","buffer","can","be","subclassed","to","change","the","encoding","used","for","the","underlying","storage","by","overriding","_encoded_data_spec",",","_encode",",","_decode",",","and","_on_delete","."]
docstr: Creates a PyUniformReplayBuffer.
  
  Args:
    data_spec: An ArraySpec or a list/tuple/nest of ArraySpecs describing a
      single item that can be stored in this buffer.
    capacity: The maximum number of items that can be stored in the buffer.
docstr_tok: ["Creates","a","PyUniformReplayBuffer",".","Args",":","data_spec",":","An","ArraySpec","or","a","list\/tuple\/nest","of","ArraySpecs","describing","a","single","item","that","can","be","stored","in","this","buffer",".","capacity",":","The","maximum","number","of","items","that","can","be","stored","in","the","buffer","."]
code: def __init__(self, data_spec, capacity):
      """Creates a PyUniformReplayBuffer.
  
      Args:
        data_spec: An ArraySpec or a list/tuple/nest of ArraySpecs describing a
          single item that can be stored in this buffer.
        capacity: The maximum number of items that can be stored in the buffer.
      """
      super(PyUniformReplayBuffer, self).__init__(data_spec, capacity)
  
      self._storage = numpy_storage.NumpyStorage(
          self._encoded_data_spec(), capacity
      )
      self._lock = threading.Lock()
      self._np_state = numpy_storage.NumpyState()
  
      # Adding elements to the replay buffer is done in a circular way.
      # Keeps track of the actual size of the replay buffer and the location
      # where to add new elements.
      self._np_state.size = np.int64(0)
      self._np_state.cur_id = np.int64(0)
  
      # Total number of items that went through the replay buffer.
      self._np_state.item_count = np.int64(0)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import threading
  import numpy
  import tensorflow
  from tf_agents.replay_buffers import replay_buffer
  from tf_agents.specs import array_spec
  from tf_agents.utils import nest_utils
  from tf_agents.utils import numpy_storage
label_desc: Use image node_id 1 to create a new PyUniformReplayBuffer object from inherited base classes: replay_buffer with example: obj = PyUniformReplayBuffer(data_spec, capacity)