What I want to do is like this, for example:
I have each layer = nn.Sequential(GRU(), LayerNorm()), and totally 4 layers.
And finally a classifier which can also be a Sequential(Linear(), Softmax())
I know that I can put these totally 5 Sequentials into an nn.ModuleList(), and use a for loop in the forward() to make the input pass through all the layers. But I want to ask if there is some function that can directly convert a ModuleList that contains multiple Sequentials to an entire Sequential.
More generally it may look like this:
func(Seq(A,B), Seq(C,D), Seq(A,E)) → Seq(A, B, C, D, A, E)
Thank you for the reply. But when I use the way you suggest, it gives me
Seqential(
Seqential(A,B),
Seqential(C,D),
Seqential(A,E)
)
instead of Seqential(A,B,C,D,A,E) that I favor.