class_docstr: An out-of-graph Replay Buffer for Prioritized Experience Replay.
  
  See circular_replay_buffer.py for details.
class_docstr_tok: ["An","out-of-graph","Replay","Buffer","for","Prioritized","Experience","Replay",".","See","circular_replay_buffer.py","for","details","."]
docstr: Returns a batch of valid indices sampled as in Schaul et al. (2015).
  
  Args:
    batch_size: int, number of indices returned.
  
  Returns:
    list of ints, a batch of valid indices sampled uniformly.
  
  Raises:
    Exception: If the batch was not constructed after maximum number of tries.
docstr_tok: ["Returns","a","batch","of","valid","indices","sampled","as","in","Schaul","et","al",".","(","2015",")",".","Args",":","batch_size",":","int",",","number","of","indices","returned",".","Returns",":","list","of","ints",",","a","batch","of","valid","indices","sampled","uniformly",".","Raises",":","Exception",":","If","the","batch","was","not","constructed","after","maximum","number","of","tries","."]
code: def sample_index_batch(self, batch_size):
      """Returns a batch of valid indices sampled as in Schaul et al. (2015).
  
      Args:
        batch_size: int, number of indices returned.
  
      Returns:
        list of ints, a batch of valid indices sampled uniformly.
  
      Raises:
        Exception: If the batch was not constructed after maximum number of tries.
      """
      # Sample stratified indices. Some of them might be invalid.
      indices = self.sum_tree.stratified_sample(batch_size)
      allowed_attempts = self._max_sample_attempts
      for i in range(len(indices)):
          if not self.is_valid_transition(indices[i]):
              if allowed_attempts == 0:
                  raise RuntimeError(
                      "Max sample attempts: Tried {} times but only sampled {}"
                      " valid indices. Batch size is {}".format(
                          self._max_sample_attempts, i, batch_size
                      )
                  )
              index = indices[i]
              while (
                  not self.is_valid_transition(index)
                  and allowed_attempts > 0
              ):
                  # If index i is not valid keep sampling others. Note that this
                  # is not stratified.
                  index = self.sum_tree.sample()
                  allowed_attempts -= 1
              indices[i] = index
      return indices
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from dopamine.replay_memory import circular_replay_buffer
  from dopamine.replay_memory import sum_tree
  from dopamine.replay_memory.circular_replay_buffer import ReplayElement
  import gin.tf
  import numpy
  import tensorflow
label_desc: Use image node_id 4 for calling the OutOfGraphPrioritizedReplayBuffer obj's underlying member method code with example usage: obj.sample_index_batch(batch_size) and returns: indices