I’m still unsure how prePoolDim would be used, but I would probably write custom modules to get the needed flexibility. If you want to reuse the sequential pattern, you could derive a custom nn.Sequential module and allow multiple input arguments, which would then be passed to the submodules.