class_docstr: The Sequential Network represents a sequence of Keras layers.
  
  It is a TF-Agents network that should be used instead of
  tf.keras.layers.Sequential. In contrast to keras Sequential, this layer can be
  used as a pure Layer in tf.functions and when exporting SavedModels, without
  having to pre-declare input and output shapes. In turn, this layer is usable
  as a preprocessing layer for TF Agents Networks, and can be exported via
  PolicySaver.
  
  Stateful Keras layers (e.g. LSTMCell, RNN, LSTM, TF-Agents DynamicUnroll)
  are all supported.  The `state_spec` of `Sequential` is a tuple whose
  length matches the number of stateful layers passed.  If no stateful layers
  or networks are passed to `Sequential` then `state_spec == ()`. Given that
  the replay buffers do not support specs with lists due to tf.nest vs
  tf.data.nest conflicts `Sequential` will also guarantee that all specs do not
  contain lists.
  
  Usage:
  ```python
  c = Sequential([layer1, layer2, layer3])
  output, next_state = c(inputs, state)
  ```
docstr: Create a Sequential Network.
  
  Args:
    layers: A list or tuple of layers to compose.  Any layers that are
      subclasses of `tf.keras.layers.{RNN,LSTM,GRU,...}` are wrapped in
      `tf_agents.keras_layers.RNNWrapper`.
    input_spec: (Optional.) A nest of `tf.TypeSpec` representing the input
      observations to the first layer.
    name: (Optional.) Network name.
  
  Raises:
    ValueError: If `layers` is empty.
    ValueError: If `layers[0]` is a generic Keras layer (not a TF-Agents
      network) and `input_spec is None`.
    TypeError: If any of the layers are not instances of keras `Layer`.
docstr_tok: ["Create","a","Sequential","Network",".","Args",":","layers",":","A","list","or","tuple","of","layers","to","compose",".","Any","layers","that","are","subclasses","of","`","tf.keras.layers.","{","RNN",",","LSTM",",","GRU",",","...","}","`","are","wrapped","in","`","tf_agents.keras_layers.RNNWrapper","`",".","input_spec",":","(","Optional",".",")","A","nest","of","`","tf.TypeSpec","`","representing","the","input","observations","to","the","first","layer",".","name",":","(","Optional",".",")","Network","name",".","Raises",":","ValueError",":","If","`","layers","`","is","empty",".","ValueError",":","If","`","layers","[","0","]","`","is","a","generic","Keras","layer","(","not","a","TF-Agents","network",")","and","`","input_spec","is","None","`",".","TypeError",":","If","any","of","the","layers","are","not","instances","of","keras","`","Layer","`","."]
code: def __init__(
      self,
      layers: Sequence[tf.keras.layers.Layer],
      input_spec: Optional[types.NestedTensorSpec] = None,
      name: Optional[Text] = None,
  ):
      """Create a Sequential Network.
  
      Args:
        layers: A list or tuple of layers to compose.  Any layers that are
          subclasses of `tf.keras.layers.{RNN,LSTM,GRU,...}` are wrapped in
          `tf_agents.keras_layers.RNNWrapper`.
        input_spec: (Optional.) A nest of `tf.TypeSpec` representing the input
          observations to the first layer.
        name: (Optional.) Network name.
  
      Raises:
        ValueError: If `layers` is empty.
        ValueError: If `layers[0]` is a generic Keras layer (not a TF-Agents
          network) and `input_spec is None`.
        TypeError: If any of the layers are not instances of keras `Layer`.
      """
      if not layers:
          raise ValueError(
              "`layers` must not be empty; saw: {}".format(layers)
          )
      for layer in layers:
          if not isinstance(layer, tf.keras.layers.Layer):
              raise TypeError(
                  "Expected all layers to be instances of keras Layer, but saw"
                  ": '{}'".format(layer)
              )
  
      layers = [
          rnn_wrapper.RNNWrapper(layer)
          if isinstance(layer, tf.keras.layers.RNN)
          else layer
          for layer in layers
      ]
  
      state_spec, self._layer_state_is_list = _infer_state_specs(layers)
  
      # Now we remove all of the empty state specs so if there are no RNN layers,
      # our state spec is empty.  layer_has_state is a list of bools telling us
      # which layers have a non-empty state and which don't.
      flattened_specs = [tf.nest.flatten(s) for s in state_spec]
      layer_has_state = [bool(fs) for fs in flattened_specs]
      state_spec = tuple(
          s
          for s, has_state in zip(state_spec, layer_has_state)
          if has_state
      )
      super(Sequential, self).__init__(
          input_tensor_spec=input_spec, state_spec=state_spec, name=name
      )
      self._sequential_layers = layers
      self._layer_has_state = layer_has_state
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import copy
  from typing import Any, List, Mapping, Optional, Sequence, Text, Tuple, Union
  import tensorflow
  from tf_agents.keras_layers import rnn_wrapper
  from tf_agents.networks import network
  from tf_agents.typing import types
  from tf_agents.utils import common
label_desc: Use image node_id 1 to create a new Sequential object from inherited base classes: network with example: obj = Sequential(layers, input_spec, name)