I have created the following network, where linear is for forwarding and ‘linears’ in modlst are for calculating loss function. The question is, will the parameters in modlst been updated after ‘loss.backward()’ and ‘optimizer.step()’? Thank you for your assistance!
class Net(torch.nn.Module):
def init(self,lag_list,in_size,out_size):
super(Net,self).init()
self.modlst=torch.nn.ModuleList([])
self.lag_list=lag_list
self.linear=torch.nn.Linear(in_size,out_size,bias=None)
self.l=len(lag_list)
for i in range(self.l):
self.modlst.append(torch.nn.Linear(in_size,out_size,bias=None))
def forward(self,x):
return self.linear(x)