class_docstr: Adder which adds entire episodes as trajectories.
class_docstr_tok: ["Adder","which","adds","entire","episodes","as","trajectories","."]
docstr: This is a helper method for generating signatures for Reverb tables.
  
  Signatures are useful for validating data types and shapes, see Reverb's
  documentation for details on how they are used.
  
  Args:
    environment_spec: A `specs.EnvironmentSpec` whose fields are nested
      structures with leaf nodes that have `.shape` and `.dtype` attributes.
      This should come from the environment that will be used to generate the
      data inserted into the Reverb table.
    extras_spec: A nested structure with leaf nodes that have `.shape` and
      `.dtype` attributes. The structure (and shapes/dtypes) of this must be
      the same as the `extras` passed into `ReverbAdder.add`.
    sequence_length: An optional integer representing the expected length of
      sequences that will be added to replay.
  
  Returns:
    A `Step` whose leaf nodes are `tf.TensorSpec` objects.
docstr_tok: ["This","is","a","helper","method","for","generating","signatures","for","Reverb","tables",".","Signatures","are","useful","for","validating","data","types","and","shapes",",","see","Reverb's","documentation","for","details","on","how","they","are","used",".","Args",":","environment_spec",":","A","`","specs.EnvironmentSpec","`","whose","fields","are","nested","structures","with","leaf","nodes","that","have","`",".shape","`","and","`",".dtype","`","attributes",".","This","should","come","from","the","environment","that","will","be","used","to","generate","the","data","inserted","into","the","Reverb","table",".","extras_spec",":","A","nested","structure","with","leaf","nodes","that","have","`",".shape","`","and","`",".dtype","`","attributes",".","The","structure","(","and","shapes\/dtypes",")","of","this","must","be","the","same","as","the","`","extras","`","passed","into","`","ReverbAdder.add","`",".","sequence_length",":","An","optional","integer","representing","the","expected","length","of","sequences","that","will","be","added","to","replay",".","Returns",":","A","`","Step","`","whose","leaf","nodes","are","`","tf.TensorSpec","`","objects","."]
code: def signature(
      cls,
      environment_spec: specs.EnvironmentSpec,
      extras_spec: types.NestedSpec = (),
      sequence_length: Optional[int] = None,
  ):
      """This is a helper method for generating signatures for Reverb tables.
  
      Signatures are useful for validating data types and shapes, see Reverb's
      documentation for details on how they are used.
  
      Args:
        environment_spec: A `specs.EnvironmentSpec` whose fields are nested
          structures with leaf nodes that have `.shape` and `.dtype` attributes.
          This should come from the environment that will be used to generate the
          data inserted into the Reverb table.
        extras_spec: A nested structure with leaf nodes that have `.shape` and
          `.dtype` attributes. The structure (and shapes/dtypes) of this must be
          the same as the `extras` passed into `ReverbAdder.add`.
        sequence_length: An optional integer representing the expected length of
          sequences that will be added to replay.
  
      Returns:
        A `Step` whose leaf nodes are `tf.TensorSpec` objects.
      """
  
      def add_time_dim(paths: Iterable[str], spec: tf.TensorSpec):
          return tf.TensorSpec(
              shape=(sequence_length, *spec.shape),
              dtype=spec.dtype,
              name="/".join(str(p) for p in paths),
          )
  
      (
          trajectory_env_spec,
          trajectory_extras_spec,
      ) = tree.map_structure_with_path(
          add_time_dim, (environment_spec, extras_spec)
      )
  
      trajectory_spec = base.Trajectory(
          *trajectory_env_spec,
          start_of_episode=tf.TensorSpec(
              shape=(sequence_length,),
              dtype=tf.bool,
              name="start_of_episode",
          ),
          extras=trajectory_extras_spec,
      )
  
      return trajectory_spec
  
file_path: acme/acme/adders/reverb/episode.py
imports: from typing import Callable, Optional, Iterable, Tuple
  from acme import specs
  from acme import types
  from acme.adders.reverb import base
  from acme.adders.reverb import utils
  import dm_env
  import numpy
  import reverb
  import tensorflow
  import tree
label_desc: Use image node_id 5 for calling the EpisodeAdder obj's underlying member method code with example usage: obj.signature(cls, environment_spec, extras_spec, sequence_length) and returns: trajectory_spec, tf