pytensor_ml.layers.Sequential#

pytensor_ml.layers.Sequential(*layers)#

Compose layers left to right into a single callable that threads its input through each in turn.

Examples

Thread an input through several layers in order. The result is itself callable, so it nests inside another Sequential wherever a block repeats:

from pytensor_ml.activations import ReLU
from pytensor_ml.layers import BatchNorm, Input, Linear, Sequential

block = Sequential(
    Linear("fc1", n_in=64, n_out=32),
    BatchNorm("bn1", n_in=32),
    ReLU(),
)
network = Sequential(
    block,
    Linear("logits", n_in=32, n_out=10),
)

logits = network(Input("X", shape=(None, 64)))