Skip to content

Instantly share code, notes, and snippets.

@CLozy
Created October 13, 2021 13:40
Show Gist options
  • Save CLozy/1054f3c30f171430006edd5aff289e53 to your computer and use it in GitHub Desktop.
Save CLozy/1054f3c30f171430006edd5aff289e53 to your computer and use it in GitHub Desktop.
classifier
for param in model.parameters():
param.requires_grad = False
from collections import OrderedDict
classifier = nn.Sequential(OrderedDict([
('fc1', nn.Linear(25088, 4096)),
('relu1', nn.ReLU()),
('drop1', nn.Dropout(p=0.5)),
('fc2', nn.Linear(4096, 4096)),
('relu2', nn.ReLU()),
('drop2', nn.Dropout(p=0.5)),
('fc3', nn.Linear(4096, 1000)),
('relu3', nn.ReLU()),
('drop3', nn.Dropout(p=0.5)),
('fc4', nn.Linear(1000,2)),
]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment