I’m trying to optimize specific channels of the input. So, my network weights are fixed and I just want to update select channels of the input. I was able to narrow down the issue to following bits of code. In my understanding following two pieces of code should be identical:
parameters = []
for i in range(nTot):
parameters.append(inpt[i][:,:channel ])
parameters.append(inpt[i][:,channel:])
optimizer = optim.Adam(parameters, lr=model.lr, weight_decay=0)
and
parameters = []
for i in range(nTot):
parameters.append(inpt[i])
optimizer = optim.Adam(parameters, lr=model.lr, weight_decay=0)
Here inpt
is a list of tensors and channel
is an integer. I find that in 2nd case, my inputs gets updated but in first case, it does not. If this works then I’ll modify the first code and will then be successful in updating only few channels of the input. Many thanks !!