I have a few models defined in list:
G = [ SomeResNet().cuda() for i in range(no_models)]
I need to define the Adam optimizer for all these models, ie G[0], G[1],...
Is the following correct?
x=[]
for i in range(no_models):
    x= itertools.chain(x, G[i].parameters())

optimizer = torch.optim.Adam(
    x, lr= 0.01, betas=(0.8, 0.9)
)