I have been recently use PyTorch Lightning to build models. But I encountered a problem. In my model, I used a list to store a number of encoders and decoders. And I store the their respective model parameters in a list too. But I found that the parameters in the list won’t be updated.
To be more specific, say
pare =
for i in range(n):
tmp_para = torch.nn.Parameter(torch.randn(n_input))
para.append(tmp_para)
self.para_list = para
the model parameters in the para list will not be updated. I didn’t check if the parameters of the encoders and decoders have been updated, but I think they are not either.
How can I fix this problem? Will a dict help?