Hi, what if the number of submodule is variable based on the user?
I tried the following
class MyModel(nn.Module):
    def __init__(self, submod_num,submod_var):
        self.submod_pool = []
        for i in range(submod_num):
            self.submod_pool += [MySubmodule(submod_var[i])]

    def forward(self,X):
        outPool = []
        for submod in self.submod_pool:
            outPool += [submod(X)]

        return torch.cat(outPool,dim)

But I’m not sure if it works because the code compile fine but the training error is not as I expected. Then I found tensorboardX 6, when I used it to draw the graph, it returns an error which clearly indicates that the graph is disconnected