How to optimize multiple fully connected layers?


(linbeibei) #1

l want to finetune a net.I made the following settings.
Modified the last three layers of fc
net.fc6 = nn.Linear(8192, 4096)
net.fc7 = nn.Linear(4096, 4096)
net.fc8 = nn.Linear(4096, 74)
optimizer = optim.SGD([{‘params’: net.fc6},{‘params’: net.fc7},{‘params’: net.fc8}], lr=0.0003, momentum=0.9)

but
It was given an error
param_group[‘params’] = list(params)
TypeError: ‘Linear’ object is not iterable

How to optimize multiple fully connected layers?


(linbeibei) #2

I know