Solved by Eta_C in post #2 
              
              
                I have never try that but I think it may work 
class Net(nn.Module):
    def __init__(self):
        super().__init__()
        self.body = nn.ModuleList() 

    def add_layer(self, layer):
        self.body.append(layer)

    def forward(self, x):
        return self.body(x)


pool = [nn.Conv2d(3, …