nn.Sequential() of the children of a model has different output than that model

Yes, because these functional calls are not modules and are thus not returned by model.children().
PyTorch allows you to define the forward pass as you wish including loops, conditions, functional API calls etc.
nn.Sequential containers are used for simple models where the execution is strictly sequential and between nn.Modules.

1 Like