Happy New Year community,
I stumbled across a strange phenomena.
I define 3 Sequentials in a model and when I go for model.parameters, I expect 6 parameters.
One weight and one bias parameter for each sequential.
Instead I get only the first sequentials.
Isn’t this problematic? The optimizer will later get all the model.parameters, but if 2 Sequentials are missing, they will not get trained as a consequence right?
import torch
import torch.nn as nn

class model(nn.Module):
    
    def __init__(self):
        super(model,self).__init__()
        sequence_generated_var = [nn.Linear(5, 1)]
        self.gen_energy = nn.Sequential(*sequence_generated_var)
        self.gen_theta = nn.Sequential(*sequence_generated_var)
        self.gen_phi = nn.Sequential(*sequence_generated_var)
    def forward(self,x):
        return
   
print([x[0] for x in m.named_parameters()])#outputs  ['gen_energy.0.weight', 'gen_energy.0.bias']

I guess there is a good explanation for the case and I hope someone can enlighten me.
Thanks in advance.