class_docstr: An adder which adds sequences of fixed length.
class_docstr_tok: ["An","adder","which","adds","sequences","of","fixed","length","."]
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 `Trajectory` 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","`","Trajectory","`","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 `Trajectory` 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)
      )
  
      spec_step = 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 spec_step
  
imports: import enum
  import operator
  from typing import Iterable, Optional
  from acme import specs
  from acme import types
  from acme.adders.reverb import base
  from acme.adders.reverb import utils
  import numpy
  import reverb
  import tensorflow
  import tree
label_desc: Use image node_id 6 for calling the SequenceAdder obj's underlying member method code with example usage: obj.signature(cls, environment_spec, extras_spec, sequence_length) and returns: spec_step, tf