Hello everyone, recently I have met with a tough issue (at least for me) when I am tring to set different learning rate to different layers.
My segmentation model consists of a pretrained encoder and a decoder, so I want to set a lower lr to pretrained encoder. The encoder consists of a set of modules which have similar names: conv_encoder1, conv_encoder2, …
So I have written some code like this:
encode_params = []
for i in range(5):
    module = eval('model.conv_encode{}'.format(i+1))
    params = list(map(id, module.parameters()))
    encode_params += params
decode_params = filter(lambda p: id(p) not in encode_params,
                     model.parameters())
optimizer = torch.optim.SGD([{'params': decode_params},
                             {'params': encode_params, 'lr': base_lr / 10}],
                            lr=base_lr, momentum=0.9)

However when running my code I get error in the topic: RuntimeError: bool value of Tensor with more than one value is ambiguous.
Also when I am running a single line of
list(decode_params)

I get the same error as this. I have no idea what goes wrong and I will appreciate it if anyone would point out the mistakes I have made in my code.
This is the first time I post a topic in PyTorch forum and please forgive me for any inappropriate language.