About using ModuleList

Hi, I got a problem when I try to use the ModuleList. Generally, I try to build a nn model like the following:

    sing_model=nn.Sequential(

        nn.Conv3d(1,16,kernel_size=3,padding=1),
        nn.ReLU(inplace=True),
        nn.Conv3d(16,16,kernel_size=3,padding=1),
        nn.ReLU(inplace=True),
        nn.MaxPool3d(kernel_size=2,stride=2),

        nn.Conv3d(16,32,kernel_size=3,padding=1),
        nn.ReLU(inplace=True),
        nn.Conv3d(32,32,kernel_size=3,padding=1),
        nn.ReLU(inplace=True),
        nn.MaxPool3d(kernel_size=2,stride=2),

        nn.Conv3d(32,32,kernel_size=3,padding=1),
        nn.ReLU(inplace=True),
        nn.Conv3d(32,32,kernel_size=3,padding=1),
        nn.ReLU(inplace=True),
        nn.MaxPool3d(kernel_size=2,stride=2),

        Flat(),
        nn.Linear(32*3*3*3,32),
        nn.ReLU(inplace=True),
        nn.Dropout(0.3),
        nn.Linear(32,4),
        nn.ReLU(),

    )
    self.multi_models=nn.ModuleList()
    for i in range(0,num_instance):
        self.multi_models.append(sing_model)

    self.classifier = nn.Sequential(
        nn.Dropout(0.3),
        nn.Linear(4*num_instance, 4*num_instance),
        nn.ReLU(inplace=True),
        nn.Dropout(0.3),
        nn.Linear(4*num_instance, num_instance),
        nn.ReLU(inplace=True),
        nn.Dropout(0.25),
        nn.Linear(num_instance, num_classes),
    )

def forward(self, x, y):
    for i in range(0,x.size(0)):
        y[i,]=self.multi_models[i](x[i,])
    y=t.cat(y,1)
    y = self.classifier(y)
    return y

i.e. there are serval sub-CNNs based on different inputs and then we combine them in the last layer of different sub-CNNs.
But, the nn model seems did’t work. I want to know whether is there something wrong?
Thank you!

because the single_model in multi_models are all the same one.

Maybe this is what you want:

def create_single_model(): 
    return nn.Sequential(
                .......
         )

     
self.multi_models=nn.ModuleList()
for i in range(0,num_instance):
        self.multi_models.append(create_sing_model())