@ptrblck @Sergius_Liu
could you please explain how did you put 4 different models in a nn.Sequential container, and then calling different submodules in their forward pass. I was trying to do that, but not sure about forward part.
class GAN(nn.Module):

    def __init__(self, args):
        super().__init__()
        
        g1 = Generator()
        g2 = Generator()
        d1 = Discriminator()
        d2 = Discriminator()
        
        self.model = nn.Sequential(g1, g2, d1, d2)
        self.model.cuda(args.device)
        self.model = torch.nn.parallel.DistributedDataParallel(self.model, [self.args.gpu])
        init_weights(self.model)

    def forward(self, x):
        ## not sure how can I access individual model and perform forward pass here
        
        return


could you please share a minimal example? also, can we achieve the same thing with nn.ModuleDict? please see the below code, i was trying something like that:
class Network(nn.Module):

    def __init__(self, args):
        super().__init__()        
        
        g1 = Generator()
        g2 = Generator()
        d1 = Discriminator()
        d2 = Discriminator()
        
        self.model = nn.ModuleDict()
        
        self.model.Gab = g1 
        self.model.Gba = g2
        self.model.Da = d1
        self.model.Db = d2
        
        self.args = args
        self.model.cuda(args.device)
        
        def parallelize(self):
            
            if self.args.distributed:
                self.model = torch.nn.parallel.DistributedDataParallel(self.model, [self.args.gpu])
                init_weights(self.model)

                # for model_key in self.model:
                #     if self.model[model_key] is not None:
                #         self.model[model_key] = torch.nn.parallel.DistributedDataParallel(self.model, [self.args.gpu])
                #         init_weights(self.model[model_key])
                        
            else:
                init_weights(self.model)
                # for model_key in self.model:
                #     if self.model[model_key] is not None:
                #         init_weights(self.model[model_key])
                
        def forward(self, x, ) :
                **# agiain I am not sure about this part..**