class_docstr: Reverb ReplayBuffer exposed as a TF-Agents replay buffer.
class_docstr_tok: ["Reverb","ReplayBuffer","exposed","as","a","TF-Agents","replay","buffer","."]
docstr: Creates and returns a dataset that returns entries from the buffer.
  
  *NOTE*: If `num_steps` does not match the `sequence_length` used in the
  observer (or if `sequence_length is None` varies from episode to episode),
  then individual sequences will be truncated to the highest possible multiple
  of `num_steps` before being split.  In this case, data loss may occur.
  For example, in sparse reward cases where there's a reward only at the final
  frame and the sequence length is not a multiple of `num_steps`, the
  reward will be dropped.
  
  *NOTE*: If `num_steps` does not match the `sequence_length` used in the
  observer (or if `sequence_length is None` varies from episode to episode),
  then individual sequences will be truncated to the highest possible multiple
  of `num_steps` before being split.  In this case, **data loss may occur**.
  For example, in sparse reward cases where there's a reward only at the final
  frame and the sequence length is not a multiple of `num_steps`, the
  reward will be dropped.
  
  When using sparse rewards at the end of sequences, the user should prefer
  to either request full episodes (e.g., `num_steps=None` and
  `sample_batch_size=None` (for variable-length episodes)); or use
  `sequence_preprocess_fn` to first propagate the rewards from the end
  of the sequence through to the earlier frames using e.g.
  temporal discounting.
  
  Args:
    sample_batch_size: See _as_dataset.
    num_steps: See _as_dataset.
    sequence_preprocess_fn: See _as_dataset.
    num_parallel_calls: Ignored.
  
  Returns:
    See `_as_dataset`.
docstr_tok: ["Creates","and","returns","a","dataset","that","returns","entries","from","the","buffer",".","*","NOTE","*",":","If","`","num_steps","`","does","not","match","the","`","sequence_length","`","used","in","the","observer","(","or","if","`","sequence_length","is","None","`","varies","from","episode","to","episode",")",",","then","individual","sequences","will","be","truncated","to","the","highest","possible","multiple","of","`","num_steps","`","before","being","split",".","In","this","case",",","data","loss","may","occur",".","For","example",",","in","sparse","reward","cases","where","there","'s","a","reward","only","at","the","final","frame","and","the","sequence","length","is","not","a","multiple","of","`","num_steps","`",",","the","reward","will","be","dropped",".","*","NOTE","*",":","If","`","num_steps","`","does","not","match","the","`","sequence_length","`","used","in","the","observer","(","or","if","`","sequence_length","is","None","`","varies","from","episode","to","episode",")",",","then","individual","sequences","will","be","truncated","to","the","highest","possible","multiple","of","`","num_steps","`","before","being","split",".","In","this","case",",","*","*","data","loss","may","occur","*","*",".","For","example",",","in","sparse","reward","cases","where","there","'s","a","reward","only","at","the","final","frame","and","the","sequence","length","is","not","a","multiple","of","`","num_steps","`",",","the","reward","will","be","dropped",".","When","using","sparse","rewards","at","the","end","of","sequences",",","the","user","should","prefer","to","either","request","full","episodes","(","e.g.",",","`","num_steps=None","`","and","`","sample_batch_size=None","`","(","for","variable-length","episodes",")",")",";","or","use","`","sequence_preprocess_fn","`","to","first","propagate","the","rewards","from","the","end","of","the","sequence","through","to","the","earlier","frames","using","e.g",".","temporal","discounting",".","Args",":","sample_batch_size",":","See","_as_dataset",".","num_steps",":","See","_as_dataset",".","sequence_preprocess_fn",":","See","_as_dataset",".","num_parallel_calls",":","Ignored",".","Returns",":","See","`","_as_dataset","`","."]
code: def _single_deterministic_pass_dataset(
      self,
      sample_batch_size=None,
      num_steps=None,
      sequence_preprocess_fn=None,
      num_parallel_calls=None,
  ):
      """Creates and returns a dataset that returns entries from the buffer.
  
      *NOTE*: If `num_steps` does not match the `sequence_length` used in the
      observer (or if `sequence_length is None` varies from episode to episode),
      then individual sequences will be truncated to the highest possible multiple
      of `num_steps` before being split.  In this case, data loss may occur.
      For example, in sparse reward cases where there's a reward only at the final
      frame and the sequence length is not a multiple of `num_steps`, the
      reward will be dropped.
  
      *NOTE*: If `num_steps` does not match the `sequence_length` used in the
      observer (or if `sequence_length is None` varies from episode to episode),
      then individual sequences will be truncated to the highest possible multiple
      of `num_steps` before being split.  In this case, **data loss may occur**.
      For example, in sparse reward cases where there's a reward only at the final
      frame and the sequence length is not a multiple of `num_steps`, the
      reward will be dropped.
  
      When using sparse rewards at the end of sequences, the user should prefer
      to either request full episodes (e.g., `num_steps=None` and
      `sample_batch_size=None` (for variable-length episodes)); or use
      `sequence_preprocess_fn` to first propagate the rewards from the end
      of the sequence through to the earlier frames using e.g.
      temporal discounting.
  
      Args:
        sample_batch_size: See _as_dataset.
        num_steps: See _as_dataset.
        sequence_preprocess_fn: See _as_dataset.
        num_parallel_calls: Ignored.
  
      Returns:
        See `_as_dataset`.
      """
      if not self._deterministic_table:
          raise ValueError(
              "Unable to perform a single deterministic pass over the dataset, "
              "since either the sampler or the remover is not deterministic "
              "(FIFO or Heap).  Table info:\n{}".format(
                  self._table_info
              )
          )
      self._verify_num_steps(num_steps)
  
      def per_sequence_fn(sample):
          # At this point, each sample data contains a sequence of trajectories.
          data, info = sample.data, sample.info
          if sequence_preprocess_fn:
              data = sequence_preprocess_fn(data)
          return data, info
  
      def dataset_transformation(dataset):
          if num_steps and num_steps != self._sequence_length:
              dataset = (
                  dataset
                  # Truncate and reshape elements to [X, num_steps, ...]
                  .map(
                      lambda *s: truncate_reshape_rows_by_num_steps(
                          s, num_steps
                      )
                  )
                  # Unbatch to get elements shaped [num_steps, ...]; each element
                  # contains non-overlapping time steps.
                  .unbatch()
              )
          return dataset
  
      dataset = make_reverb_dataset(
          self._server_address,
          self._table_name,
          data_spec=self._data_spec,
          batch_size=sample_batch_size,
          sequence_length=self._sequence_length,
          per_sequence_fn=per_sequence_fn,
          dataset_transformation=dataset_transformation,
          # Try to make it as deterministic as possible.
          cycle_length=1,
          num_parallel_calls=1,
          max_in_flight_samples_per_worker=1,
          num_workers_per_iterator=1,
          rate_limiter_timeout_ms=self._rate_limiter_timeout_ms,
      )
  
      return dataset
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import gin
  import tensorflow.compat.v2
  from tf_agents.replay_buffers import replay_buffer
  from tf_agents.typing import types
  from tf_agents.utils import lazy_loader
label_desc: Use image node_id 10 for calling the ReverbReplayBuffer obj's underlying member method code with example usage: obj._single_deterministic_pass_dataset(sample_batch_size, num_steps, sequence_preprocess_fn, num_parallel_calls) and returns: dataset, data,  info, dataset