Suppose that I defined a class as follows:
class A(nn.Module):
    def __init__(self, some_params):
          #SOMETHING HERE (for example several Linear)
    def forward(self, x):
          #SOMETHING ELSE HERE

Now, suppose I want to use an array of class A in another model. Does the following way work?
class B(nn.Module):
    def __init__(self, some_params):
          self.a = [ ]
          for i in range(100):
                 self.a.append(A(some_params))
    def forward(self, x):
          outs = [ ]
          for i in range(100):
                 out = self.a(x[ i ])
                 outs.append(out)
           outs_concat = outs[0]
           for i in range(1,100):
                 outs_concat = torch.cat((outs_concat, outs[ i ]), 1)

Moreover, would someone please tell me how can I be sure about the parameters? Do the parameters in module A act as paramters of module B? Because I want to update all parameters when I call optimizer and I do not know how to become sure about updating all parameters.
I am looking forward to see your solutions.
Regards,
Sina