I have tried my initial versions of code and they got error like this:

when running code below:

  ...: base_lr = 1e-4
  ...: encode_params = []
  ...: for i in range(5):
  ...:     module = eval('model.conv_encode{}'.format(i+1))
  ...:     params = list(module.parameters())
  ...:     encode_params += params
  ...: decode_params = filter(lambda p: 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)
Traceback (most recent call last):
  File "D:\Anaconda3\envs\torch\lib\site-packages\IPython\core\interactiveshell.py", line 3331, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-2-36fa8cf864b8>", line 57, in <module>
    lr=base_lr, momentum=0.9)
  File "D:\Anaconda3\envs\torch\lib\site-packages\torch\optim\sgd.py", line 64, in __init__
    super(SGD, self).__init__(params, defaults)
  File "D:\Anaconda3\envs\torch\lib\site-packages\torch\optim\optimizer.py", line 51, in __init__
    self.add_param_group(param_group)
  File "D:\Anaconda3\envs\torch\lib\site-packages\torch\optim\optimizer.py", line 195, in add_param_group
    param_group['params'] = list(params)
  File "<ipython-input-2-36fa8cf864b8>", line 53, in <lambda>
    decode_params = filter(lambda p: p not in encode_params,
RuntimeError: The size of tensor a (64) must match the size of tensor b (7) at non-singleton dimension 3


when running code below (I think this version may be entirely wrong)

  ...: base_lr = 1e-4
  ...: encode_params = []
  ...: for i in range(5):
  ...:     module = eval('model.conv_encode{}'.format(i+1))
  ...:     params = list(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)
Traceback (most recent call last):
  File "D:\Anaconda3\envs\torch\lib\site-packages\IPython\core\interactiveshell.py", line 3331, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-5-91e3d95a8795>", line 11, in <module>
    lr=base_lr, momentum=0.9)
  File "D:\Anaconda3\envs\torch\lib\site-packages\torch\optim\sgd.py", line 64, in __init__
    super(SGD, self).__init__(params, defaults)
  File "D:\Anaconda3\envs\torch\lib\site-packages\torch\optim\optimizer.py", line 51, in __init__
    self.add_param_group(param_group)
  File "D:\Anaconda3\envs\torch\lib\site-packages\torch\optim\optimizer.py", line 195, in add_param_group
    param_group['params'] = list(params)
  File "<ipython-input-5-91e3d95a8795>", line 7, in <lambda>
    decode_params = filter(lambda p: id(p) not in encode_params,
RuntimeError: bool value of Tensor with more than one value is ambiguous