class flax.linen.Sequential(layers, parent=<flax.linen.module._Sentinel object>, name=None)[source]#

Applies a linear chain of Modules.

Meant to be used only for the simple case of fusing together callables where the input of a particular module/op is the output of the previous one.

Modules will be applied in the order that they are passed in the constructor.

The apply() method of Sequential accepts any input and forwards it to the first module it contains. It chains the output sequentially to the input of the next module and returns the output of the final module.

Example usage:

class Foo(nn.Module):
  feature_sizes: Sequence[int]

  def __call__(self, x):
    return nn.Sequential([nn.Dense(4),
__call__(*args, **kwargs)[source]#

Call self as a function.