Save the date! Google I/O returns May 18-20 Register now


The SequentialLayer represents a sequence of Keras layers.

It is a Keras Layer that can be used instead of tf.keras.layers.Sequential, which is actually a Keras Model. 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.


c = SequentialLayer([layer1, layer2, layer3])
output = c(inputs)    # Equivalent to: output = layer3(layer2(layer1(inputs)))

layers A list or tuple of layers to compose.
**kwargs Arguments to pass to Keras layer initializer, including name.

TypeError If any of the layers are not instances of keras Layer.